jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/536640 )
Change subject: [IMPR] Simplify some Namespace methods
......................................................................
[IMPR] Simplify some Namespace methods
- replace "'' + name" with "name"
- return False in __eq__ if no instance type match
- change calc sequence or add and sub
- use boolean result directly instead of comparing with empty string
Change-Id: I323454aaeaaf5535e6de630983357ca5d3ef8e05
---
M pywikibot/site.py
1 file changed, 17 insertions(+), 13 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index f63c034..1536cd4 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -305,10 +305,11 @@
"""Return the name with required colons, depending on the ID."""
if id == 0:
return ':'
- elif id in (6, 14):
+
+ if id in (6, 14):
return ':' + name + ':'
- else:
- return '' + name + ':'
+
+ return name + ':'
def __str__(self):
"""Return the canonical string representation."""
@@ -342,11 +343,15 @@
"""Compare whether two namespace objects are equal."""
if isinstance(other, int):
return self.id == other
- elif isinstance(other, Namespace):
+
+ if isinstance(other, Namespace):
return self.id == other.id
- elif isinstance(other, UnicodeType):
+
+ if isinstance(other, UnicodeType):
return other in self
+ return False
+
def __ne__(self, other):
"""Compare whether two namespace objects are not equal."""
return not self.__eq__(other)
@@ -357,11 +362,11 @@
def __sub__(self, other):
"""Apply subtraction on the namespace id."""
- return -(other) + self.id
+ return self.id - other
def __add__(self, other):
"""Apply addition on the namespace id."""
- return other + self.id
+ return self.id + other
def _cmpkey(self):
"""Return the ID as a comparison key."""
@@ -420,17 +425,16 @@
parts = name.split(':', 4)
count = len(parts)
- if count > 3:
+ if count > 3 or (count == 3 and parts[2]):
return False
- elif count == 3:
- if parts[2] != '':
- return False
# Discard leading colon
- if count >= 2 and parts[0] == '' and parts[1]:
+ if count >= 2 and not parts[0] and parts[1]:
return parts[1].strip()
- elif parts[0]:
+
+ if parts[0]:
return parts[0].strip()
+
return False
@classmethod
--
To view, visit https://gerrit.wikimedia.org/r/536640
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I323454aaeaaf5535e6de630983357ca5d3ef8e05
Gerrit-Change-Number: 536640
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Lokal Profil <andre.costa(a)wikimedia.se>
Gerrit-CC: Matěj Suchánek <matejsuchanek97(a)gmail.com>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/538838 )
Change subject: [doc] Update HISTORY.rst
......................................................................
[doc] Update HISTORY.rst
Change-Id: I20985211be77900e4b66dd8d6b30b33debd74cc5
---
M HISTORY.rst
1 file changed, 5 insertions(+), 0 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index 9f2509a..02893b9 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,11 @@
Current release
---------------
+* Implement deletedrevisions api call (T75370)
+* assert_valid_iter_params may raise AssertionError instead of pywikibot.Error (T233582)
+* Upcast getRedirectTarget result and return the appropriate page subclass (T233392)
+* Add ListGenerator for API:filearchive to site module (T230196)
+* Deprecate the ability to login with a secondary sysop account (T71283)
* Enable global args with pwb.py wrapper script (T216825)
* Add a new ConfigParserBot class to set options from the scripts.ini file (T223778)
* Check a user's rights rather than group memberships; 'sysopnames' will be deprecated (T229293, T189126, T122705, T119335, T75545)
--
To view, visit https://gerrit.wikimedia.org/r/538838
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I20985211be77900e4b66dd8d6b30b33debd74cc5
Gerrit-Change-Number: 538838
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/539923 )
Change subject: [bugfix] Fix typos in several script docs
......................................................................
[bugfix] Fix typos in several script docs
Change-Id: I52d0d08069620906d604fdcb31636a290bbb0e6e
---
M scripts/coordinate_import.py
M scripts/newitem.py
2 files changed, 5 insertions(+), 5 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/coordinate_import.py b/scripts/coordinate_import.py
index 5e4fe61..5e73f17 100755
--- a/scripts/coordinate_import.py
+++ b/scripts/coordinate_import.py
@@ -22,8 +22,8 @@
-namespace:0 -transcludes:Infobox_stazione_ferroviaria
You can also run over a set of items on the repo without coordinates and
-try to import them from any connected page. To do this, you need to
-explicitly provide the repo as the site using -lang a -family arguments.
+try to import them from any connected page. To do this, you have to
+explicitly provide the repo as the site using -lang and -family arguments.
Example:
python pwb.py coordinate_import -lang:wikidata -family:wikidata \
diff --git a/scripts/newitem.py b/scripts/newitem.py
index 956d287..712b71e 100755
--- a/scripts/newitem.py
+++ b/scripts/newitem.py
@@ -5,7 +5,7 @@
* When was the (Wikipedia) page created?
* When was the last edit on the page?
-* Does the page contain interwiki's?
+* Does the page contain interwikis?
This script understands various command-line arguments:
@@ -16,7 +16,7 @@
created.
-touch Do a null edit on every page which has a wikibase item.
- Be careful, this option can trigger edit rates or captachas
+ Be careful, this option can trigger edit rates or captchas
if your account is not autoconfirmed.
"""
@@ -164,7 +164,7 @@
'not in the autoconfirmed group on {}. Script '
'will not touch pages linked to newly created '
'items to avoid triggering edit rates or '
- 'captachas. Use -touch param to force this.'
+ 'captchas. Use -touch param to force this.'
.format(user.username, bot.site.sitename)))
bot.options['touch'] = False
bot.run()
--
To view, visit https://gerrit.wikimedia.org/r/539923
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I52d0d08069620906d604fdcb31636a290bbb0e6e
Gerrit-Change-Number: 539923
Gerrit-PatchSet: 2
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/539924 )
Change subject: [bugfix] Fix new doc error in site.py
......................................................................
[bugfix] Fix new doc error in site.py
Change-Id: I868a95429ed19c4db28d21bb83f0a1e4a953fbd2
---
M pywikibot/site.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index d1b6518..dc8675d 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2283,7 +2283,7 @@
@type reverse: bool
@param is_ts: When comparing timestamps (with is_ts=True) the start
is usually greater than end. Comparing titles this is vice versa.
- type is_ts: bool
+ @type is_ts: bool
@raises AssertionError: start/end values are in wrong order
"""
if reverse ^ is_ts:
--
To view, visit https://gerrit.wikimedia.org/r/539924
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I868a95429ed19c4db28d21bb83f0a1e4a953fbd2
Gerrit-Change-Number: 539924
Gerrit-PatchSet: 3
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/538384 )
Change subject: [bugfix] enable creating sites from url for closed wikis
......................................................................
[bugfix] enable creating sites from url for closed wikis
>>> import pwb, pywikibot as py
>>> s = py.Site(url='https://hz.wikipedia.org/wiki/$1')
>>> s
ClosedSite("hz", "wikipedia")
>>>
Bug: T233487
Change-Id: Ia8846d152ab7349a8f84913af03f84908de13b42
---
M pywikibot/family.py
1 file changed, 4 insertions(+), 1 deletion(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 2333640..f12ef93 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1309,7 +1309,10 @@
return None
matched_sites = []
- for code in chain(self.codes, getattr(self, 'test_codes', ())):
+ for code in chain(self.codes,
+ getattr(self, 'test_codes', ()),
+ getattr(self, 'closed_wikis', ()),
+ ):
if self._hostname(code)[1] == parsed.netloc:
# Use the code and family instead of the url
# This is only creating a Site instance if domain matches
--
To view, visit https://gerrit.wikimedia.org/r/538384
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia8846d152ab7349a8f84913af03f84908de13b42
Gerrit-Change-Number: 538384
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/539357 )
Change subject: FilePage: Ignore revision with 'filemissing' field
......................................................................
FilePage: Ignore revision with 'filemissing' field
According to gerrit:533482, entries with the 'filemissing' field omit the
following fields: 'timestamp', 'userhidden', 'user', 'userid', 'anon', 'size',
'width', 'height', 'pagecount', 'duration', 'commenthidden', 'parsedcomment',
'comment', 'thumburl', 'thumbwidth', 'thumbheight', 'thumbmime', 'thumberror',
'url', 'sha1', 'metadata', 'extmetadata', 'commonmetadata', 'mime',
'mediadtype', 'bitdepth'.
This means that the revision is unusable for all intents and purposes, so we
just throw a warning and ignore it.
Bug: T233959
Change-Id: I76d12a4558de9c21464ec63e9b780736ee47e405
---
M pywikibot/page.py
1 file changed, 6 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 33176bf..5fa4c69 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2480,6 +2480,12 @@
def _load_file_revisions(self, imageinfo):
for file_rev in imageinfo:
+ # filemissing in API response indicates most fields are missing
+ # see https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/533482/
+ if 'filemissing' in file_rev:
+ pywikibot.warning("File '%s' contains missing revisions"
+ % self.title())
+ continue
file_revision = FileInfo(file_rev)
self._file_revisions[file_revision.timestamp] = file_revision
--
To view, visit https://gerrit.wikimedia.org/r/539357
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I76d12a4558de9c21464ec63e9b780736ee47e405
Gerrit-Change-Number: 539357
Gerrit-PatchSet: 3
Gerrit-Owner: Strainu <wiki(a)strainu.ro>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)