jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/735987 )
Change subject: [cleanup] Deprecate boolean watch parameter in Page.save()
......................................................................
[cleanup] Deprecate boolean watch parameter in Page.save()
Change-Id: I3d00cbcdf8410ff90768238df50222eeb2f7fb3c
---
M pywikibot/page/__init__.py
1 file changed, 16 insertions(+), 13 deletions(-)
Approvals:
JJMC89: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index 59d5781..f70199f 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -1132,16 +1132,21 @@
def save(self,
summary: Optional[str] = None,
- watch: Union[str, bool, None] = None,
+ watch: Optional[str] = None,
minor: bool = True,
botflag: Optional[bool] = None,
force: bool = False,
asynchronous: bool = False,
- callback=None, apply_cosmetic_changes=None,
- quiet: bool = False, **kwargs):
+ callback=None,
+ apply_cosmetic_changes: Optional[bool] = None,
+ quiet: bool = False,
+ **kwargs):
"""
Save the current contents of page's text to the wiki.
+ .. versionchanged:: 7.0
+ boolean watch parameter is deprecated
+
:param summary: The edit summary for the modification (optional, but
most wikis strongly encourage its use)
:param watch: Specify how the watchlist is affected by this edit, set
@@ -1151,11 +1156,6 @@
* preferences: use the preference settings (Default)
* nochange: don't change the watchlist
If None (default), follow bot account's default settings
-
- For backward compatibility watch parameter may also be boolean:
- if True, add or if False, remove this Page to/from bot
- user's watchlist.
- :type watch: str, bool (deprecated) or None
:param minor: if True, mark this edit as minor
:param botflag: if True, mark this edit as made by a bot (default:
True if user has bot status, False if not)
@@ -1170,7 +1170,6 @@
successful.
:param apply_cosmetic_changes: Overwrites the cosmetic_changes
configuration value to this value unless it's None.
- :type apply_cosmetic_changes: bool or None
:param quiet: enable/disable successful save operation message;
defaults to False.
In asynchronous mode, if True, it is up to the calling bot to
@@ -1178,10 +1177,14 @@
"""
if not summary:
summary = config.default_edit_summary
- if watch is True:
- watch = 'watch'
- elif watch is False:
- watch = 'unwatch'
+
+ if isinstance(watch, bool):
+ issue_deprecation_warning(
+ 'boolean watch parameter',
+ '"watch", "unwatch", "preferences" or "nochange" value',
+ since='7.0.0')
+ watch = ('unwatch', 'watch')[watch]
+
if not force and not self.botMayEdit():
raise OtherPageSaveError(
self, 'Editing restricted by {{bots}}, {{nobots}} '
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/735987
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: I3d00cbcdf8410ff90768238df50222eeb2f7fb3c
Gerrit-Change-Number: 735987
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/736824 )
Change subject: [IMPR] Show an empty string if a environment variable is empty
......................................................................
[IMPR] Show an empty string if a environment variable is empty
If a environment variable is empty, nothing is printed. Now show an
empty string delimited by quotes if a environment variable is empty.
Also use repr() for family names instead of double quotes.
Change-Id: Ie044d8e58418ce7e4c756d4b7935b33e8d0d6f80
---
M scripts/version.py
1 file changed, 4 insertions(+), 4 deletions(-)
Approvals:
JJMC89: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/version.py b/scripts/version.py
index e4fa31a..9a2cf3d 100755
--- a/scripts/version.py
+++ b/scripts/version.py
@@ -85,15 +85,15 @@
settings.update(['PYWIKIBOT_DIR', 'PYWIKIBOT_DIR_PWB',
'PYWIKIBOT_NO_USER_CONFIG'])
for environ_name in sorted(settings):
- pywikibot.output('{}: {}'.format(environ_name,
- os.environ.get(environ_name,
- 'Not set')))
+ pywikibot.output(
+ '{}: {}'.format(environ_name,
+ os.environ.get(environ_name, 'Not set') or "''"))
pywikibot.output('Config base dir: ' + pywikibot.config.base_dir)
for family, usernames in pywikibot.config.usernames.items():
if not usernames:
continue
- pywikibot.output('Usernames for family "{}":'.format(family))
+ pywikibot.output('Usernames for family {!r}:'.format(family))
for lang, username in usernames.items():
pywikibot.output('\t{}: {}'.format(lang, username))
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/736824
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: Ie044d8e58418ce7e4c756d4b7935b33e8d0d6f80
Gerrit-Change-Number: 736824
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/736464 )
Change subject: [bugfix]: Upload: Only set filekey/offset for files with names
......................................................................
[bugfix]: Upload: Only set filekey/offset for files with names
When copy-uploading, the filekey and offset should not be set, as
this applies only when there is a filename, but during a copy-upload,
there is only a URL.
Bug: T294916
Change-Id: I38d0915ca46f2e144522e4c63961b3dc09a1943f
---
M pywikibot/site/_apisite.py
1 file changed, 19 insertions(+), 10 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 4d11d71..8a7854f 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -2863,26 +2863,35 @@
if result['result'] == 'Warning':
assert 'warnings' in result and not ignore_all_warnings
- if 'filekey' in result:
- _file_key = result['filekey']
- elif 'sessionkey' in result:
- # TODO: Probably needs to be reflected in the API call
- # above
- _file_key = result['sessionkey']
- pywikibot.warning('Using sessionkey instead of filekey.')
+
+ if source_filename:
+ if 'filekey' in result:
+ _file_key = result['filekey']
+ elif 'sessionkey' in result:
+ # TODO: Probably needs to be reflected in the API call
+ # above
+ _file_key = result['sessionkey']
+ pywikibot.warning(
+ 'Using sessionkey instead of filekey.')
+ else:
+ _file_key = None
+ pywikibot.warning('No filekey defined.')
else:
_file_key = None
- pywikibot.warning('No filekey defined.')
if not report_success:
- result.setdefault('offset', True)
+ if source_filename:
+ offset = result.setdefault('offset', True)
+ else:
+ offset = False
+
if ignore_warnings(create_warnings_list(result)):
return self.upload(
filepage, source_filename=source_filename,
source_url=source_url, comment=comment,
text=text, watch=watch, ignore_warnings=True,
chunk_size=chunk_size, asynchronous=asynchronous,
- _file_key=_file_key, _offset=result['offset'],
+ _file_key=_file_key, _offset=offset,
report_success=False)
return False
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/736464
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: I38d0915ca46f2e144522e4c63961b3dc09a1943f
Gerrit-Change-Number: 736464
Gerrit-PatchSet: 3
Gerrit-Owner: Inductiveload <inductiveload(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
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/+/736181 )
Change subject: [doc] update ROADMAP.rst and CHANGELOG.md
......................................................................
[doc] update ROADMAP.rst and CHANGELOG.md
Change-Id: Iecaaa4391ef3fd6eb94e398517802e173f9699f6
---
M ROADMAP.rst
M scripts/CHANGELOG.md
2 files changed, 14 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 0b525c1..817a239 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -4,6 +4,8 @@
Improvements and Bugfixes
-------------------------
+* Update invisible characters from unicodedata 14.0.0
+* Make site parameter of textlib.replace_links() mandatory (T294649)
* Raise a generic ServerError if the http status code is unofficial (T293208)
* Add support for Wikimedia OCR engine with proofreadpage
* Rewrite tools.intersect_generators which makes it running up to 10'000 times faster. (T85623, T293276)
@@ -22,6 +24,13 @@
Code cleanups
-------------
+* Remove deprecated BaseSite namespace shortcuts
+* Remove deprecated Family.get_cr_templates method in favour of Site.category_redirects()
+* Remove deprecated Page.put_async() method (T193494)
+* Ignore baserevid parameter for several DataSite methods
+* Remove deprecated preloaditempages method
+* Remove disable_ssl_certificate_validation kwargs in http functions in favour of verify parameter (T265206)
+* Deprecated PYWIKIBOT2 environment variables were removed
* version.ParseError was removed in favour of exceptions.VersionParseError
* specialbots.EditReplacement and specialbots.EditReplacementError were removed in favour of exceptions.EditReplacementError
* site.PageInUse exception was removed in favour of exceptions.PageInUseError
@@ -57,9 +66,9 @@
Deprecations
^^^^^^^^^^^^
+* 7.0.0: baserevid parameter of editSource(), editQualifier(), removeClaims(), removeSources(), remove_qualifiers() DataSite methods will be removed
* 7.0.0: Values of APISite.allpages() parameter filterredir other than True, False and None are deprecated
* 6.5.0: OutputOption.output() method will be removed in favour of OutputOption.out property
* 6.4.0: Pywikibot `began using semantic versioning
<https://www.mediawiki.org/wiki/Manual:Pywikibot/Development/Guidelines#Depr…>`_,
all deprecated code will be removed in Pywikibot version 7.0.0.
-* 5.0.0: Methods deprecated for 5 years or longer will be removed
diff --git a/scripts/CHANGELOG.md b/scripts/CHANGELOG.md
index 138d75d..b87f57f 100644
--- a/scripts/CHANGELOG.md
+++ b/scripts/CHANGELOG.md
@@ -23,6 +23,9 @@
### commonscat
* Ignore InvalidTitleError in CommonscatBot.findCommonscatLink (T291783)
+### cosmetic_changes
+* Ignore InvalidTitleError in CosmeticChangesBot.treat_page (T293612)
+
### djvutext
* pass site arg only once (T292367)
@@ -88,7 +91,7 @@
* Enable multiple sites (T57083)
* Use new textlib.add_text function
-### cosmetic_changeds
+### cosmetic_changes
* set -ignore option to CANCEL.MATCH by default (T108446)
### fixing_redirects
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/736181
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: Iecaaa4391ef3fd6eb94e398517802e173f9699f6
Gerrit-Change-Number: 736181
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
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/+/735990 )
Change subject: [cleanup] Remove deprecated Page.put_async() method
......................................................................
[cleanup] Remove deprecated Page.put_async() method
Bug: T193494
Change-Id: I424dbbe2474e20f70ec7c49d8d0ce8615121bab2
---
M pywikibot/page/__init__.py
1 file changed, 0 insertions(+), 17 deletions(-)
Approvals:
JJMC89: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index 59d5781..ee2a538 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -1266,23 +1266,6 @@
force=force, asynchronous=asynchronous, callback=callback,
**kwargs)
- @deprecated('put(asynchronous=True) or save(asynchronous=True)',
- since='20180501')
- def put_async(self, newtext, summary=None, watch=None, minor=True,
- botflag=None, force=False, callback=None,
- **kwargs): # pragma: no cover
- """
- Put page on queue to be saved to wiki asynchronously.
-
- Asynchronous version of put (takes the same arguments), which places
- pages on a queue to be saved by a daemon thread. All arguments are
- the same as for .put(). This version is maintained solely for
- backwards-compatibility.
- """
- self.put(newtext, summary=summary, watch=watch,
- minor=minor, botflag=botflag, force=force,
- asynchronous=True, callback=callback, **kwargs)
-
def watch(self, unwatch: bool = False) -> bool:
"""
Add or remove this page to/from bot account's watchlist.
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/735990
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: I424dbbe2474e20f70ec7c49d8d0ce8615121bab2
Gerrit-Change-Number: 735990
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/673520 )
Change subject: [tests] Add darglint to flake8 tests
......................................................................
[tests] Add darglint to flake8 tests
Bug: T277396
Change-Id: Ibff1bd68b83b2b4255c8b02e69da0741384b6222
---
M pywikibot/data/api.py
M pywikibot/flow.py
M pywikibot/proofreadpage.py
M pywikibot/textlib.py
M setup.py
M tox.ini
6 files changed, 13 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 021e1c3..bbc6097 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1430,7 +1430,7 @@
:param params: HTTP request params
:param mime_params: HTTP request parts which must be sent in the body
- :type mime_params: dict of (content, keytype, headers)
+ :type mime_params: dict of (content, keytype, headers) # noqa: DAR103
:return: HTTP request headers and body
"""
# construct a MIME message containing all API key/values
diff --git a/pywikibot/flow.py b/pywikibot/flow.py
index c99bb4f..855a45e 100644
--- a/pywikibot/flow.py
+++ b/pywikibot/flow.py
@@ -131,7 +131,7 @@
:param reverse: Whether to reverse the topic ordering.
:param include_offset: Whether to include the offset topic.
:param toc_only: Whether to only include information for the TOC.
- :return: A generator of this board's topics.
+ :yield: A generator of this board's topics.
"""
data = self.site.load_topiclist(self, content_format=content_format,
limit=limit, sortby=sort_by,
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index 55b288c..6357816 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -571,7 +571,7 @@
:return: file url of the scan ProofreadPage or None.
:raises Exception: in case of http errors
- :raise ImportError: if bs4 is not installed, _bs4_soup() will raise
+ :raises ImportError: if bs4 is not installed, _bs4_soup() will raise
:raises ValueError: in case of no prp_page_image src found for scan
"""
# wrong link fails with various possible Exceptions.
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 0b9668e..e02ac96 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -1210,7 +1210,7 @@
:param links: interwiki links to be formatted
:type links: dict with the Site objects as keys, and Page
- or Link objects as values.
+ or Link objects as values. # noqa: DAR103
:param insite: site the interwiki links will be formatted for
(defaulting to the current site).
:type insite: BaseSite
@@ -1272,13 +1272,12 @@
def getCategoryLinks(text: str, site=None,
include: Optional[List[str]] = None,
- expand_text: bool = False) -> list:
+ expand_text: bool = False) -> List['pywikibot.Category']:
"""Return a list of category links found in text.
:param include: list of tags which should not be removed by
removeDisabledParts() and where CategoryLinks can be searched.
:return: all category links found
- :rtype: list of Category objects
"""
result = []
if site is None:
diff --git a/setup.py b/setup.py
index 3b2c386..c11224f 100644
--- a/setup.py
+++ b/setup.py
@@ -75,6 +75,7 @@
'http': ['fake_useragent'],
'flake8': [ # Due to incompatibilities between packages the order matters.
'flake8>=3.9.1',
+ 'darglint',
'pydocstyle>=4.0.0',
'flake8-bugbear!=21.4.1',
'flake8-coding',
diff --git a/tox.ini b/tox.ini
index 9c66d78..a6e64be 100644
--- a/tox.ini
+++ b/tox.ini
@@ -106,11 +106,17 @@
# D412: No blank lines allowed between a section header and its content
# D413: Missing blank line after last section
-ignore = B007,C103,D105,D211,D401,D413,D412,FI1,H101,H238,H301,H306,H404,H405,H903,P101,P102,P103,P205,W503
+# DARXXX: Darglint docstring issues to be solved
+
+ignore = B007,C103,D105,D211,D401,D413,D412,DAR003,DAR101,DAR102,DAR201,DAR202,DAR301,DAR401,DAR402,DAR501,FI1,H101,H238,H301,H306,H404,H405,H903,P101,P102,P103,P205,W503
enable-extensions = H203,H204,H205
exclude = .tox,.git,./*.egg,build,./scripts/i18n/*
classmethod-decorators = classmethod,classproperty
+# darglint
+strictness=short
+docstring_style=sphinx
+ignore_regex=:keyword
# flake8-coding
# note: C103 can be removed from ignore if scripts are cleaned from coding part
no-accept-encodings = true
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/673520
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: Ibff1bd68b83b2b4255c8b02e69da0741384b6222
Gerrit-Change-Number: 673520
Gerrit-PatchSet: 19
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged