jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/947717 )
Change subject: [dod] fix spelling mistak in throttle.py
......................................................................
[dod] fix spelling mistak in throttle.py
Change-Id: I307ad5a59ab1be8c397aa37f4e0a10acb8993160
---
M pywikibot/throttle.py
1 file changed, 11 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/throttle.py b/pywikibot/throttle.py
index 0404497..2241059 100644
--- a/pywikibot/throttle.py
+++ b/pywikibot/throttle.py
@@ -1,6 +1,6 @@
"""Mechanics to slow down wiki read and/or write rate."""
#
-# (C) Pywikibot team, 2008-2022
+# (C) Pywikibot team, 2008-2023
#
# Distributed under the terms of the MIT license.
#
@@ -139,7 +139,7 @@
"""Count running processes for site and set process_multiplicity.
.. versionchanged:: 7.0
- process is not written to throttle.ctrl file is site is empty
+ process is not written to throttle.ctrl file if site is empty.
"""
global pid
mysite = self.mysite
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/947717
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I307ad5a59ab1be8c397aa37f4e0a10acb8993160
Gerrit-Change-Number: 947717
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/947356 )
Change subject: [doc] Fix logging documentation
......................................................................
[doc] Fix logging documentation
Change-Id: Ia8e5ae17a3fe1f799ee686c4774b46250f37e39f
---
M pywikibot/logging.py
1 file changed, 17 insertions(+), 8 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/logging.py b/pywikibot/logging.py
index 9dafa11..f87bf92 100644
--- a/pywikibot/logging.py
+++ b/pywikibot/logging.py
@@ -20,7 +20,7 @@
argument, which is a string indicating the debugging layer.
"""
#
-# (C) Pywikibot team, 2010-2022
+# (C) Pywikibot team, 2010-2023
#
# Distributed under the terms of the MIT license.
#
@@ -175,7 +175,7 @@
are interpreted as for :func:`logoutput`.
.. versionchanged:: 7.2
- was renamed to :func:`info`; `text`was renamed to `msg`; `msg`
+ was renamed to :func:`info`; `text` was renamed to `msg`; `msg`
paramerer may be omitted; only keyword arguments are allowed except
for `msg`.
.. seealso::
@@ -196,7 +196,7 @@
The arguments are interpreted as for :func:`logoutput`.
.. versionchanged:: 7.2
- `text`was renamed to `msg`; `msg` parameter may be omitted;
+ `text` was renamed to `msg`; `msg` parameter may be omitted;
only keyword arguments are allowed except for `msg`.
.. seealso::
- :python:`Logger.log()<library/logging.html#logging.Logger.log>`
@@ -214,7 +214,7 @@
The arguments are interpreted as for :func:`logoutput`.
.. versionchanged:: 7.2
- `text`was renamed to `msg`; only keyword arguments are allowed
+ `text` was renamed to `msg`; only keyword arguments are allowed
except for `msg`.
.. seealso::
:python:`Logger.warning()<library/logging.html#logging.Logger.warning>`
@@ -231,7 +231,7 @@
The arguments are interpreted as for :func:`logoutput`.
.. versionchanged:: 7.2
- `text`was renamed to `msg`; only keyword arguments are allowed
+ `text` was renamed to `msg`; only keyword arguments are allowed
except for `msg`.
.. seealso::
:python:`Logger.error()<library/logging.html#logging.Logger.error>`
@@ -247,7 +247,7 @@
The arguments are interpreted as for :func:`logoutput`.
.. versionchanged:: 7.2
- `text`was renamed to `msg`; only keyword arguments are allowed
+ `text` was renamed to `msg`; only keyword arguments are allowed
except for `msg`.
.. seealso::
:python:`Logger.log()<library/logging.html#logging.Logger.log>`
@@ -264,7 +264,7 @@
The arguments are interpreted as for :func:`logoutput`.
.. versionchanged:: 7.2
- `text`was renamed to `msg`; only keyword arguments are allowed
+ `text` was renamed to `msg`; only keyword arguments are allowed
except for `msg`.
.. seealso::
:python:`Logger.critical()
@@ -281,7 +281,7 @@
The arguments are interpreted as for :func:`logoutput`.
.. versionchanged:: 7.2
- `layer` parameter is optional; `text`was renamed to `msg`;
+ `layer` parameter is optional; `text` was renamed to `msg`;
only keyword arguments are allowed except for `msg`.
.. seealso::
:python:`Logger.debug()<library/logging.html#logging.Logger.debug>`
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/947356
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ia8e5ae17a3fe1f799ee686c4774b46250f37e39f
Gerrit-Change-Number: 947356
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944234 )
Change subject: [cleanup] Remove mw_version check in api.Request._add_defaults
......................................................................
[cleanup] Remove mw_version check in api.Request._add_defaults
Python 8 supports mw 1.27 only; therefore remove the mw check.
This leads that site.version() is no longer called and the
error messages aren't printed. Update tests accordingly.
Bug: T306637
Change-Id: Ie91e5120931b757123659d2cc457f2d8a7413b06
---
M pywikibot/data/api/_requests.py
M tests/api_tests.py
2 files changed, 18 insertions(+), 11 deletions(-)
Approvals:
Xqt: Verified; Looks good to me, approved
diff --git a/pywikibot/data/api/_requests.py b/pywikibot/data/api/_requests.py
index ee19e54..7e7758c 100644
--- a/pywikibot/data/api/_requests.py
+++ b/pywikibot/data/api/_requests.py
@@ -438,8 +438,7 @@
# dummy rawcontinue parameter except for 'tokens' (T284577) and
# 'siteinfo' (T343204)
if ('tokens' not in meta and 'siteinfo' not in meta
- and 'continue' not in self._params
- and self.site.mw_version >= '1.25wmf5'):
+ and 'continue' not in self._params):
self._params.setdefault('rawcontinue', [''])
elif self.action == 'help':
diff --git a/tests/api_tests.py b/tests/api_tests.py
index 783e1b5..dbffb21 100755
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -856,8 +856,7 @@
@patch.object(pywikibot, 'info')
@patch.object(pywikibot, 'warning')
- @patch.object(pywikibot, 'error')
- def test_access_denied_notexist_username(self, error, warning, output):
+ def test_access_denied_notexist_username(self, warning, info):
"""Test the query with a username which does not exist."""
self.site._username = 'Not registered username'
req = api.Request(site=self.site, parameters={'action': 'query'})
@@ -869,10 +868,8 @@
warning.assert_called_with(
'API error readapidenied: '
'You need read permission to use this module.')
- error.assert_called_with(
- 'You have no API read permissions. Seems you are not logged in.')
self.assertIn(
- 'Logging in to steward:steward as ', output.call_args[0][0])
+ 'Logging in to steward:steward as ', info.call_args[0][0])
class TestLazyLoginNoUsername(TestLazyLoginBase):
@@ -880,9 +877,8 @@
"""Test no username."""
@patch.object(pywikibot, 'warning')
- @patch.object(pywikibot, 'error')
@patch.object(pywikibot.config, 'usernames', defaultdict(dict))
- def test_access_denied_no_username(self, error, warning):
+ def test_access_denied_no_username(self, warning):
"""Test the query without a username."""
self.site._username = None
req = api.Request(site=self.site, parameters={'action': 'query'})
@@ -894,8 +890,6 @@
warning.assert_called_with(
'API error readapidenied: '
'You need read permission to use this module.')
- error.assert_called_with(
- 'You have no API read permissions. Seems you are not logged in.')
class TestUrlEncoding(TestCase):
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944234
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ie91e5120931b757123659d2cc457f2d8a7413b06
Gerrit-Change-Number: 944234
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944210 )
Change subject: [cleanup] Remove unused _query_continue method.
......................................................................
[cleanup] Remove unused _query_continue method.
QueryGenerator._query_continue method is no longer used since
b8060a7e8b8553f5beca6046809c7f99cc66a0c8 and can be removed.
rename _continue() method to continue_update and merge it
with _add_continues. Always return None with it instead of
False because the result is not important anymore.
This looks like a breaking change but it does not care.
Bug: T343204
Change-Id: I4eaa37f150f8c0d9a008419637b7c320385708b0
---
M pywikibot/data/api/_generators.py
1 file changed, 31 insertions(+), 22 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api/_generators.py b/pywikibot/data/api/_generators.py
index 1a30567..3090ef3 100644
--- a/pywikibot/data/api/_generators.py
+++ b/pywikibot/data/api/_generators.py
@@ -237,7 +237,6 @@
parameters['indexpageids'] = True # always ask for list of pageids
self.continue_name = 'continue'
- self.continue_update = self._continue
# Explicitly enable the simplified continuation
parameters['continue'] = True
self.request = self.request_class(**kwargs)
@@ -476,24 +475,18 @@
return None
- def _query_continue(self) -> bool:
- if all(key not in self.data[self.continue_name]
- for key in self.continuekey):
- pywikibot.log(
- "Missing '{}' key(s) in ['{}'] value."
- .format(self.continuekey, self.continue_name))
- return True
+ def continue_update(self) -> None:
+ """Update query with continue parameters.
- for query_continue_pair in self.data['query-continue'].values():
- self._add_continues(query_continue_pair)
- return False # a new request with query-continue is needed
-
- def _continue(self) -> bool:
- self._add_continues(self.data['continue'])
- return False # a new request with continue is needed
-
- def _add_continues(self, continue_pair) -> None:
- for key, value in continue_pair.items():
+ .. versionadded:: 3.0
+ .. versionchanged:: 4.0
+ explicit return a bool value to be used in :meth:`generator`
+ .. versionchanged:: 6.0
+ always return *False*
+ .. versionchanged:: 8.4
+ return *None* instead of *False*.
+ """
+ for key, value in self.data['continue'].items():
# query-continue can return ints (continue too?)
if isinstance(value, int):
value = str(value)
@@ -653,10 +646,8 @@
if self.continue_name not in self.data:
break
- if self.continue_update():
- break
-
- del self.data # a new request with (query-)continue is needed
+ self.continue_update()
+ del self.data # a new request with continue is needed
def result(self, data):
"""Process result data as needed for particular subclass."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944210
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I4eaa37f150f8c0d9a008419637b7c320385708b0
Gerrit-Change-Number: 944210
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944181 )
Change subject: [cleanup] remove "continue" parameter from siteinfo request
......................................................................
[cleanup] remove "continue" parameter from siteinfo request
Also remove site.mw_version check due to T306637.
Keep adding rawcontinue until other dependencies are solved.
Keep site.mw_version check, otherwise api_tests.TestLazyLoginNoUsername
fails.
Bug: T343204
Change-Id: I8bc3101d257630ab61bfbb436f35253065de0ab4
---
M pywikibot/site/_siteinfo.py
M pywikibot/data/api/_requests.py
2 files changed, 22 insertions(+), 9 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api/_requests.py b/pywikibot/data/api/_requests.py
index 25f7e57..ee19e54 100644
--- a/pywikibot/data/api/_requests.py
+++ b/pywikibot/data/api/_requests.py
@@ -434,11 +434,11 @@
and self.site.has_extension('ProofreadPage'):
prop = set(self['prop'] + ['proofread'])
self['prop'] = sorted(prop)
- # When neither 'continue' nor 'rawcontinue' is present and the
- # version number is at least 1.25wmf5 we add a dummy rawcontinue
- # parameter. Querying siteinfo is save as it adds 'continue'
- # except for 'tokens' (T284577)
- if ('tokens' not in meta and 'continue' not in self._params
+ # When neither 'continue' nor 'rawcontinue' is present we add a
+ # dummy rawcontinue parameter except for 'tokens' (T284577) and
+ # 'siteinfo' (T343204)
+ if ('tokens' not in meta and 'siteinfo' not in meta
+ and 'continue' not in self._params
and self.site.mw_version >= '1.25wmf5'):
self._params.setdefault('rawcontinue', [''])
diff --git a/pywikibot/site/_siteinfo.py b/pywikibot/site/_siteinfo.py
index 2863823..4aa01df 100644
--- a/pywikibot/site/_siteinfo.py
+++ b/pywikibot/site/_siteinfo.py
@@ -1,6 +1,6 @@
"""Objects representing site info data contents."""
#
-# (C) Pywikibot team, 2008-2022
+# (C) Pywikibot team, 2008-2023
#
# Distributed under the terms of the MIT license.
#
@@ -158,9 +158,7 @@
'action': 'query', 'meta': 'siteinfo', 'siprop': props,
}
)
- # With 1.25wmf5 it'll require continue or rawcontinue. As we don't
- # continue anyway we just always use continue.
- request['continue'] = True
+
# warnings are handled later
request._warning_handler = warn_handler
try:
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944181
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I8bc3101d257630ab61bfbb436f35253065de0ab4
Gerrit-Change-Number: 944181
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/945938 )
Change subject: [todo] remove unnecessary or unclear todo hints
......................................................................
[todo] remove unnecessary or unclear todo hints
Change-Id: I3fd3b23611ee364ea149068962e1fd1feffd813c
---
M pywikibot/diff.py
M pywikibot/bot.py
2 files changed, 23 insertions(+), 17 deletions(-)
Approvals:
Matěj Suchánek: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index d40f640..2d788ba 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -2363,7 +2363,6 @@
:return: pywikibot.ItemPage or None
"""
if not summary:
- # FIXME: i18n
summary = 'Bot: New item with sitelink from {}'.format(
page.title(as_link=True, insite=self.repo))
diff --git a/pywikibot/diff.py b/pywikibot/diff.py
index 09caf2a..b80a1e3 100644
--- a/pywikibot/diff.py
+++ b/pywikibot/diff.py
@@ -396,22 +396,20 @@
return pending
return None
- # TODO: Missing commands (compared to git --patch): edit and search
- help_msg = {'y': 'accept this hunk',
- 'n': 'do not accept this hunk',
- 'q': 'do not accept this hunk and quit reviewing',
- 'a': 'accept this hunk and all other pending',
- 'd': 'do not apply this hunk or any of the later hunks in '
- 'the file',
- 'g': 'select a hunk to go to',
- 'j': 'leave this hunk undecided, see next undecided hunk',
- 'J': 'leave this hunk undecided, see next hunk',
- 'k': 'leave this hunk undecided, see previous undecided '
- 'hunk',
- 'K': 'leave this hunk undecided, see previous hunk',
- 's': 'split this hunk into smaller ones',
- '?': 'help',
- }
+ help_msg = {
+ 'y': 'accept this hunk',
+ 'n': 'do not accept this hunk',
+ 'q': 'do not accept this hunk and quit reviewing',
+ 'a': 'accept this hunk and all other pending',
+ 'd': 'do not apply this or any of the later hunks in the file',
+ 'g': 'select a hunk to go to',
+ 'j': 'leave this hunk undecided, see next undecided hunk',
+ 'J': 'leave this hunk undecided, see next hunk',
+ 'k': 'leave this hunk undecided, see previous undecided hunk',
+ 'K': 'leave this hunk undecided, see previous hunk',
+ 's': 'split this hunk into smaller ones',
+ '?': 'help',
+ }
super_hunks = self._generate_super_hunks(
h for h in self.hunks if h.reviewed == Hunk.PENDING)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/945938
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I3fd3b23611ee364ea149068962e1fd1feffd813c
Gerrit-Change-Number: 945938
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged