jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676659 )
Change subject: [doc] Use predefined substitutions
......................................................................
[doc] Use predefined substitutions
Bug: T279179
Change-Id: Iba2f445e331ad61f8ae1a3fc9b1a8ed418d87045
---
M CODE_OF_CONDUCT.rst
M README.rst
A docs/.rstcheck.cfg
M docs/index.rst
M tox.ini
5 files changed, 11 insertions(+), 6 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/CODE_OF_CONDUCT.rst b/CODE_OF_CONDUCT.rst
index ea6ab54..3615c22 100644
--- a/CODE_OF_CONDUCT.rst
+++ b/CODE_OF_CONDUCT.rst
@@ -1,5 +1,6 @@
Code of Conduct
---------------
-The development of this software is covered by a `Code of Conduct <https://www.mediawiki.org/wiki/Code_of_Conduct>`_.
+The development of this software is covered by a
+`Code of Conduct <https://www.mediawiki.org/wiki/Code_of_Conduct>`_.
diff --git a/README.rst b/README.rst
index 86253d5..6b1a91f 100644
--- a/README.rst
+++ b/README.rst
@@ -50,6 +50,7 @@
python pwb.py script_name
Or to install using PyPI (excluding scripts)
+
::
pip install -U setuptools
diff --git a/docs/.rstcheck.cfg b/docs/.rstcheck.cfg
new file mode 100644
index 0000000..c4c9400
--- /dev/null
+++ b/docs/.rstcheck.cfg
@@ -0,0 +1,3 @@
+[rstcheck]
+ignore_directives=automodule,autoclass,autofunction
+ignore_messages=(Undefined substitution referenced: "(release|today|version)")
\ No newline at end of file
diff --git a/docs/index.rst b/docs/index.rst
index 22ceaa0..2edeb3f 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,7 +1,7 @@
-Pywikibot 6.1.0 Documentation
-=============================
+Pywikibot Documentation
+=======================
-Welcome! This is the documentation for Pywikibot 6.1.0.
+Welcome! This is the documentation for Pywikibot |release|.
.. note::
@@ -17,7 +17,7 @@
Wikipedia, it is now used throughout the Wikimedia Foundation's projects and
on many other MediaWiki wikis.
-The project started in 2003 and is currently on core version 6.1.0.
+The project started in 2003 and is currently on core version |version|.
It features full API usage and is up-to-date with new MediaWiki features and
a Pythonic package layout. But it also works with older installations of
MediaWiki 1.23 or higher.
diff --git a/tox.ini b/tox.ini
index a9b7962..032eb03 100644
--- a/tox.ini
+++ b/tox.ini
@@ -63,7 +63,7 @@
[testenv:doc]
commands =
sphinx-build -M html ./docs ./docs/_build
- rstcheck --recursive --report warning --ignore-directives automodule,autoclass,autofunction .
+ rstcheck --recursive --report warning .
basepython = python3
deps =
-rrequirements.txt
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676659
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: Iba2f445e331ad61f8ae1a3fc9b1a8ed418d87045
Gerrit-Change-Number: 676659
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/+/676603 )
Change subject: [doc] Add favicon to doc
......................................................................
[doc] Add favicon to doc
Change-Id: Iefda966e37cbea76afab0923fad0f3fa7b8c3619
---
A docs/Pywikibot.ico
M docs/conf.py
2 files changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/Pywikibot.ico b/docs/Pywikibot.ico
new file mode 100644
index 0000000..031cfe9
--- /dev/null
+++ b/docs/Pywikibot.ico
Binary files differ
diff --git a/docs/conf.py b/docs/conf.py
index c559df9..f237685 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -169,7 +169,7 @@
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#
-# html_favicon = None
+html_favicon = 'Pywikibot.ico'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676603
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: Iefda966e37cbea76afab0923fad0f3fa7b8c3619
Gerrit-Change-Number: 676603
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/+/676281 )
Change subject: [IMPR] Show a more informative warning if content.decode() fails
......................................................................
[IMPR] Show a more informative warning if content.decode() fails
Show a more informative warning if content.decode() fails with
UnicodeDecodeError. It is not very helpfull to get a
"Unknown or invalid encoding" message if the reason is the
content e.g. found a b'\xe4\xf6\xfc'
Change-Id: I9d534e002bec33865873b736720723f93a8e01de
---
M pywikibot/comms/http.py
1 file changed, 8 insertions(+), 4 deletions(-)
Approvals:
Matěj Suchánek: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index b31f531..5807013 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -449,14 +449,18 @@
"""Helper function to try decoding."""
if encoding is None:
return None
+
try:
content.decode(encoding)
- except (LookupError, UnicodeDecodeError):
+ except LookupError:
pywikibot.warning('Unknown or invalid encoding {!r}'
.format(encoding))
- # let chardet do the job
- return None
- return encoding
+ except UnicodeDecodeError as e:
+ pywikibot.warning('{} found in {}'.format(e, content))
+ else:
+ return encoding
+
+ return None # let chardet do the job
header_encoding = _get_encoding_from_response_headers(response)
if header_encoding is None:
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676281
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: I9d534e002bec33865873b736720723f93a8e01de
Gerrit-Change-Number: 676281
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/674583 )
Change subject: [IMPR] Simplify comparing empty sequences
......................................................................
[IMPR] Simplify comparing empty sequences
Change-Id: I80fa74ea1f2c29cb121b723fc0e20594a124a90a
---
M pywikibot/page/__init__.py
M pywikibot/tools/__init__.py
M scripts/checkimages.py
M scripts/weblinkchecker.py
M scripts/welcome.py
M tests/pagegenerators_tests.py
M tests/site_tests.py
7 files changed, 13 insertions(+), 13 deletions(-)
Approvals:
Matěj Suchánek: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index 19fc629..6a071b5 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -851,7 +851,7 @@
disambigs.update(self.site._disambigtemplates)
# see if any template on this page is in the set of disambigs
disambig_in_page = disambigs.intersection(templates)
- return self.namespace() != 10 and len(disambig_in_page) > 0
+ return self.namespace() != 10 and disambig_in_page
@deprecated_args(withTemplateInclusion='with_template_inclusion',
onlyTemplateInclusion='only_template_inclusion',
@@ -4565,7 +4565,7 @@
if hasattr(self, 'hash') and self.hash is not None:
data['hash'] = self.hash
else:
- if len(self.qualifiers) > 0:
+ if self.qualifiers:
data['qualifiers'] = {}
data['qualifiers-order'] = list(self.qualifiers.keys())
for prop, qualifiers in self.qualifiers.items():
@@ -4573,7 +4573,8 @@
assert qualifier.isQualifier is True
data['qualifiers'][prop] = [
qualifier.toJSON() for qualifier in qualifiers]
- if len(self.sources) > 0:
+
+ if self.sources:
data['references'] = []
for collection in self.sources:
reference = {
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 2274554..54ace92 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -1357,8 +1357,7 @@
since = kwargs.pop('since', None)
future_warning = kwargs.pop('future_warning', False)
- without_parameters = (len(args) == 1 and len(kwargs) == 0
- and callable(args[0]))
+ without_parameters = len(args) == 1 and not kwargs and callable(args[0])
if 'instead' in kwargs:
instead = kwargs['instead']
elif not without_parameters and len(args) == 1:
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index cde33f7..aaeba52 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -943,7 +943,7 @@
self.report(text_for_the_report, image_to_tag,
commImage=dupComment_image, unver=True)
- if len(images_to_tag_list) != 0 and not only_report:
+ if images_to_tag_list and not only_report:
fp = pywikibot.FilePage(self.site, images_to_tag_list[-1])
already_reported_in_past = fp.revision_count(self.bots)
from_regex = (r'\n\*\[\[:%s%s\]\]'
diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index 9670077..192fc9f 100755
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -491,7 +491,7 @@
def run(self):
"""Run thread."""
while not self.killed:
- if len(self.queue) == 0:
+ if not self.queue:
if self.finishing:
break
time.sleep(0.1)
diff --git a/scripts/welcome.py b/scripts/welcome.py
index f03fa4d..99fb090 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -901,7 +901,7 @@
"""Load the badword list and the whitelist."""
page = re.compile(r'(?:\"|\')(.*?)(?:\"|\')(?:, |\))')
list_loaded = page.findall(raw)
- if len(list_loaded) == 0:
+ if not list_loaded:
pywikibot.output('There was no input on the real-time page.')
return list_loaded
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 5bf1bec..0b6d4e0 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -1495,7 +1495,7 @@
super().setUpClass()
site = pywikibot.Site()
newuser_logevents = list(site.logevents(logtype='newusers', total=1))
- if len(newuser_logevents) == 0:
+ if not newuser_logevents:
raise unittest.SkipTest('No newuser logs found to test with.')
login = True
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 2e6c595..d39ee83 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -410,11 +410,11 @@
def test_categorymembers(self):
"""Test Site.categorymembers."""
cats = list(self.site.pagecategories(self.mainpage))
- if len(cats) == 0:
+ if not cats:
self.skipTest('Main page is not in any categories.')
- else:
- for cm in self.site.categorymembers(cats[0]):
- self.assertIsInstance(cm, pywikibot.Page)
+
+ for cm in self.site.categorymembers(cats[0]):
+ self.assertIsInstance(cm, pywikibot.Page)
def test_pageimages(self):
"""Test Site.pageimages."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/674583
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: I80fa74ea1f2c29cb121b723fc0e20594a124a90a
Gerrit-Change-Number: 674583
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/674565 )
Change subject: [cleanup] remove getSite function
......................................................................
[cleanup] remove getSite function
getSite is deprecated for 5 years and FutureWarning is shown with 5.0.0.
This function is different from Site.getSite() method.
Change-Id: I5f388116b324e7e185e19225f35ebddb2999cf4d
---
M pywikibot/__init__.py
1 file changed, 0 insertions(+), 6 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 0ac60bb..e2a4292 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -58,7 +58,6 @@
normalize_username,
MediaWikiVersion as _MediaWikiVersion,
ModuleDeprecationWrapper as _ModuleDeprecationWrapper,
- redirect_func,
)
from pywikibot.tools.formatter import color_format
@@ -1161,11 +1160,6 @@
return _sites[key]
-# alias for backwards-compability
-getSite = redirect_func(Site, old_name='getSite', since='20150924',
- future_warning=True)
-
-
# These imports depend on Wb* classes above.
from pywikibot.page import ( # noqa: E402
Page,
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/674565
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: I5f388116b324e7e185e19225f35ebddb2999cf4d
Gerrit-Change-Number: 674565
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged