jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/773909 )
Change subject: [7.2] Prepare next release 7.2
......................................................................
[7.2] Prepare next release 7.2
Change-Id: I787dc85a4a599506710421a8de0b19dfc123a9b6
---
M .appveyor.yml
M HISTORY.rst
M ROADMAP.rst
M pywikibot/__metadata__.py
4 files changed, 28 insertions(+), 20 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.appveyor.yml b/.appveyor.yml
index 98eb712..e0d352f 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,7 +1,7 @@
image: Visual Studio 2019
clone_depth: 50
skip_tags: true
-version: 7.1.{build}
+version: 7.2.{build}
environment:
PYWIKIBOT_DIR: "%appdata%\\Pywikibot"
diff --git a/HISTORY.rst b/HISTORY.rst
index d578d5c..193a690 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,6 +1,30 @@
Release history
^^^^^^^^^^^^^^^
+7.1.0
+-----
+*26 March 2022*
+
+* Add FilePage.file_is_used property to determine whether a file is used on a site
+* Add support for guwwiki and shnwikivoyage (:phab:`T303762`, :phab:`T302799`)
+* TextExtracts support was aded (:phab:`T72682`)
+* Unused `get_redirect` parameter of Page.getOldVersion() has been dropped
+* Provide BasePage.get_parsed_page() a public method
+* Provide BuiltinNamespace.canonical_namespaces() with BuiltinNamespace IntEnum
+* BuiltinNamespace got a canonical() method
+* Enable nested templates with MultiTemplateMatchBuilder (:phab:`T110529`)
+* Introduce APISite.simple_request as a public method
+* Provide an Uploader class to upload files
+* Enable use of deletetalk parameter of the delete API
+* Fix contextlib redirection for terminal interfaces (:phab:`T283808`)
+* No longer use win32_unicode for Python 3.6+ (:phab:`T281042`, :phab:`T283808`, :phab:`T303373`)
+* L10N updates
+* -cosmetic_changes (-cc) option allows to assign the value directly instead of toggle it
+* distutils.util.strtobool() was implemented as tools.strtobool() due to :pep:`632`
+* The "in" operator always return whether the siteinfo contains the key even it is not cached (:phab:`T302859`)
+* Siteinfo.clear() and Siteinfo.is_cached() methods were added
+
+
7.0.0
-----
*26 February 2022*
diff --git a/ROADMAP.rst b/ROADMAP.rst
index c0dafb4..ca68e8c 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,24 +1,8 @@
Current release changes
^^^^^^^^^^^^^^^^^^^^^^^
-* Add FilePage.file_is_used property to determine whether a file is used on a site
-* Add support for guwwiki and shnwikivoyage (:phab:`T303762`, :phab:`T302799`)
-* TextExtracts support was aded (:phab:`T72682`)
-* Unused `get_redirect` parameter of Page.getOldVersion() has been dropped
-* Provide BasePage.get_parsed_page() a public method
-* Provide BuiltinNamespace.canonical_namespaces() with BuiltinNamespace IntEnum
-* BuiltinNamespace got a canonical() method
-* Enable nested templates with MultiTemplateMatchBuilder (:phab:`T110529`)
-* Introduce APISite.simple_request as a public method
-* Provide an Uploader class to upload files
-* Enable use of deletetalk parameter of the delete API
-* Fix contextlib redirection for terminal interfaces (:phab:`T283808`)
-* No longer use win32_unicode for Python 3.6+ (:phab:`T281042`, :phab:`T283808`, :phab:`T303373`)
-* L10N updates
-* -cosmetic_changes (-cc) option allows to assign the value directly instead of toggle it
-* distutils.util.strtobool() was implemented as tools.strtobool() due to :pep:`632`
-* The "in" operator always return whether the siteinfo contains the key even it is not cached (:phab:`T302859`)
-* Siteinfo.clear() and Siteinfo.is_cached() methods were added
+* (no change yet)
+
Deprecations
^^^^^^^^^^^^
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index a8e7954..88af118 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -11,7 +11,7 @@
__name__ = 'pywikibot'
-__version__ = '7.1.0'
+__version__ = '7.2.0.dev0'
__description__ = 'Python MediaWiki Bot Framework'
__maintainer__ = 'The Pywikibot team'
__maintainer_email__ = 'pywikibot(a)lists.wikimedia.org'
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/773909
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: I787dc85a4a599506710421a8de0b19dfc123a9b6
Gerrit-Change-Number: 773909
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/+/773820 )
Change subject: [doc] remove phabricator links with setup.py
......................................................................
[doc] remove phabricator links with setup.py
Change-Id: Id06069838903f80ebcc8d2e95435ea7ca4360f7b
---
M setup.py
1 file changed, 4 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/setup.py b/setup.py
index ae07b29..25715ac 100755
--- a/setup.py
+++ b/setup.py
@@ -34,6 +34,7 @@
#
# ## KEEP PYTHON 2 SUPPORT FOR THIS SCRIPT ## #
import os
+import re
import sys
@@ -216,6 +217,7 @@
Combine included restructured text files which must be done before
uploading because the source isn't available after creating the package.
"""
+ pattern = r'\:phab\:`(T\d+)`', r'\1'
desc = []
with open(filename) as f:
for line in f:
@@ -223,11 +225,11 @@
include = os.path.relpath(line.rsplit('::')[1].strip())
if os.path.exists(include):
with open(include) as g:
- desc.append(g.read())
+ desc.append(re.sub(*pattern, g.read()))
else:
print('Cannot include {}; file not found'.format(include))
else:
- desc.append(line)
+ desc.append(re.sub(*pattern, line))
return ''.join(desc)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/773820
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: Id06069838903f80ebcc8d2e95435ea7ca4360f7b
Gerrit-Change-Number: 773820
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/+/773748 )
Change subject: [doc] update ROADMAP.rst and CHANGELOG.md
......................................................................
[doc] update ROADMAP.rst and CHANGELOG.md
Change-Id: I64cbf30626bacb19817283e81d745af80f912e6d
---
M ROADMAP.rst
M scripts/CHANGELOG.md
2 files changed, 4 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index d6f87bf..c0dafb4 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,6 +1,8 @@
Current release changes
^^^^^^^^^^^^^^^^^^^^^^^
+* Add FilePage.file_is_used property to determine whether a file is used on a site
+* Add support for guwwiki and shnwikivoyage (:phab:`T303762`, :phab:`T302799`)
* TextExtracts support was aded (:phab:`T72682`)
* Unused `get_redirect` parameter of Page.getOldVersion() has been dropped
* Provide BasePage.get_parsed_page() a public method
diff --git a/scripts/CHANGELOG.md b/scripts/CHANGELOG.md
index 5c7082d..7a5b24e 100644
--- a/scripts/CHANGELOG.md
+++ b/scripts/CHANGELOG.md
@@ -8,7 +8,8 @@
* -always option was enabled
### reflinks
-* Decode pdfinfo if it is bytes content (:phab:`:phab:`T303731``)
+* Solve UnicodeDecodeError in ReferencesRobot.treat() (:phab:`T304288`)
+* Decode pdfinfo if it is bytes content (:phab:`T303731`)
## 7.0.0
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/773748
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: I64cbf30626bacb19817283e81d745af80f912e6d
Gerrit-Change-Number: 773748
Gerrit-PatchSet: 1
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/+/772015 )
Change subject: [W0048] Merge 'if' statements
......................................................................
[W0048] Merge 'if' statements
Also shorten for loop in Claim.same_as()
Change-Id: I956d564a0ac268f4bbdfeb0bc3efc4ef9d55054b
---
M pywikibot/page/_pages.py
M pywikibot/page/_wikibase.py
2 files changed, 16 insertions(+), 20 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/_pages.py b/pywikibot/page/_pages.py
index 3d48204..852f0ad 100644
--- a/pywikibot/page/_pages.py
+++ b/pywikibot/page/_pages.py
@@ -1910,9 +1910,8 @@
for item in self.site.deletedrevs(self, start=timestamp,
content=content, total=1, **kwargs):
# should only be one item with one revision
- if item['title'] == self.title():
- if 'revisions' in item:
- return item['revisions'][0]
+ if item['title'] == self.title() and 'revisions' in item:
+ return item['revisions'][0]
return []
def markDeletedRevision(self, timestamp, undelete: bool = True):
@@ -2136,10 +2135,9 @@
def __init__(self, source, title: str = '', ns=0) -> None:
"""Instantiate a Page object."""
- if isinstance(source, pywikibot.site.BaseSite):
- if not title:
- raise ValueError('Title must be specified and not empty '
- 'if source is a Site.')
+ if isinstance(source, pywikibot.site.BaseSite) and not title:
+ raise ValueError('Title must be specified and not empty '
+ 'if source is a Site.')
super().__init__(source, title, ns)
@property
@@ -3129,9 +3127,9 @@
mailrequest = self.site.simple_request(**params)
maildata = mailrequest.submit()
- if 'emailuser' in maildata:
- if maildata['emailuser']['result'] == 'Success':
- return True
+ if 'emailuser' in maildata \
+ and maildata['emailuser']['result'] == 'Success':
+ return True
return False
def block(self, *args, **kwargs):
diff --git a/pywikibot/page/_wikibase.py b/pywikibot/page/_wikibase.py
index 503bee3..f90577e 100644
--- a/pywikibot/page/_wikibase.py
+++ b/pywikibot/page/_wikibase.py
@@ -1395,28 +1395,26 @@
ignore_refs: bool = True
) -> bool:
"""Check if two claims are same."""
- if ignore_rank:
- attributes = ['id', 'snaktype', 'target']
- else:
- attributes = ['id', 'snaktype', 'rank', 'target']
+ attributes = ['id', 'snaktype', 'target']
+ if not ignore_rank:
+ attributes.append('rank')
for attr in attributes:
if getattr(self, attr) != getattr(other, attr):
return False
- if not ignore_quals:
- if not self._claim_mapping_same(self.qualifiers, other.qualifiers):
- return False
+ if not (ignore_quals or self._claim_mapping_same(self.qualifiers,
+ other.qualifiers)):
+ return False
if not ignore_refs:
if len(self.sources) != len(other.sources):
return False
+
for source in self.sources:
- same = False
for other_source in other.sources:
if self._claim_mapping_same(source, other_source):
- same = True
break
- if not same:
+ else:
return False
return True
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/772015
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: I956d564a0ac268f4bbdfeb0bc3efc4ef9d55054b
Gerrit-Change-Number: 772015
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/+/771852 )
Change subject: [IMPR] Use PrettyPrinter to show config variables
......................................................................
[IMPR] Use PrettyPrinter to show config variables
Change-Id: I1441a09c0505e8e3c7e433afaf619fd43987c055
---
M pywikibot/config.py
1 file changed, 3 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config.py b/pywikibot/config.py
index 193ec03..d8ad1ff 100644
--- a/pywikibot/config.py
+++ b/pywikibot/config.py
@@ -1127,6 +1127,8 @@
# When called as main program, list all configuration variables
#
if __name__ == '__main__': # pragma: no cover
+ from pprint import PrettyPrinter as _PrettyPrinter
+ _pp = _PrettyPrinter()
_all = True
for _arg in sys.argv[1:]:
if _arg == 'modified':
@@ -1142,7 +1144,7 @@
_value = globals()[_name]
if _name not in _private_values or not _value:
- _value = repr(_value)
+ _value = _pp.pformat(_value)
elif isinstance(_value, dict):
_value = '{ ...xxxxxxxx... }'
elif hasattr(_value, '__dict__'):
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/771852
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: I1441a09c0505e8e3c7e433afaf619fd43987c055
Gerrit-Change-Number: 771852
Gerrit-PatchSet: 2
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/+/770509 )
Change subject: [IMPR] Add file_is_used to determine whether a file is used on a site
......................................................................
[IMPR] Add file_is_used to determine whether a file is used on a site
Also add some tests.
Change-Id: I1b5f7d24b78fab453713d0ce559a8d5f219d81c4
---
M pywikibot/page/_pages.py
M tests/file_tests.py
2 files changed, 12 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/_pages.py b/pywikibot/page/_pages.py
index 3d48204..781caae 100644
--- a/pywikibot/page/_pages.py
+++ b/pywikibot/page/_pages.py
@@ -2478,6 +2478,14 @@
"""
return self.site.imageusage(self, total=total, content=content)
+ @property
+ def file_is_used(self) -> bool:
+ """Check whether the file is used at this site.
+
+ .. versionadded:: 7.1
+ """
+ return bool(list(self.usingPages(total=1)))
+
def upload(self, source: str, **kwargs) -> bool:
"""
Upload this file to the wiki.
diff --git a/tests/file_tests.py b/tests/file_tests.py
index d01d93b..ef81ba4 100755
--- a/tests/file_tests.py
+++ b/tests/file_tests.py
@@ -61,7 +61,9 @@
self.assertTrue(commons_file.exists())
self.assertTrue(itwp_file.file_is_shared())
+ self.assertFalse(itwp_file.file_is_used)
self.assertTrue(commons_file.file_is_shared())
+ self.assertTrue(commons_file.file_is_used)
self.assertTrue(commons_file.get_file_url())
self.assertIn('/wikipedia/commons/', itwp_file.get_file_url())
@@ -124,7 +126,9 @@
self.assertTrue(commons_file.exists())
self.assertFalse(itwp_file.file_is_shared())
+ self.assertTrue(itwp_file.file_is_used)
self.assertTrue(commons_file.file_is_shared())
+ self.assertTrue(commons_file.file_is_used)
def testNonFileLocal(self):
"""Test file page, without local file, existing on the local wiki."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/770509
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: I1b5f7d24b78fab453713d0ce559a8d5f219d81c4
Gerrit-Change-Number: 770509
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged