jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/569319 )
Change subject: [IMPR] use dict.get() and dict.setdefault() in aspects.py
......................................................................
[IMPR] use dict.get() and dict.setdefault() in aspects.py
Improve readablity and decrease code commplexity
Change-Id: I925ef5a6a2f09aabbe6acaa9f8829e41f60f18bb
---
M tests/aspects.py
1 file changed, 15 insertions(+), 18 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/aspects.py b/tests/aspects.py
index 0aaffab..8f301d2 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -7,7 +7,7 @@
mixin to show cache usage is included.
"""
#
-# (C) Pywikibot team, 2014-2019
+# (C) Pywikibot team, 2014-2020
#
# Distributed under the terms of the MIT license.
#
@@ -794,11 +794,11 @@
else:
hostnames = []
- if 'net' in dct and dct['net'] is False:
+ if dct.get('net') is False:
dct['site'] = False
- if 'sites' in dct and 'site' not in dct:
- dct['site'] = True
+ if 'sites' in dct:
+ dct.setdefault('site', True)
# If either are specified, assume both should be specified
if 'family' in dct or 'code' in dct:
@@ -816,13 +816,12 @@
}
if hostnames:
- if 'sites' not in dct:
- dct['sites'] = {}
+ dct.setdefault('sites', {})
for hostname in hostnames:
assert hostname not in dct['sites']
dct['sites'][hostname] = {'hostname': hostname}
- if 'dry' in dct and dct['dry'] is True:
+ if dct.get('dry') is True:
dct['net'] = False
if (('sites' not in dct and 'site' not in dct)
@@ -834,7 +833,7 @@
# test class dependencies are declarative, this requires the
# test writer explicitly sets 'site=False' so code reviewers
# check that the script invoked by pwb will not load a site.
- if 'pwb' in dct and dct['pwb']:
+ if dct.get('pwb'):
if 'site' not in dct:
raise Exception(
'{}: Test classes using pwb must set "site"; add '
@@ -861,30 +860,28 @@
# The following section is only processed if the test uses sites.
- if 'dry' in dct and dct['dry']:
+ if dct.get('dry'):
bases = cls.add_base(bases, DisconnectedSiteMixin)
del dct['net']
else:
dct['net'] = True
- if 'cacheinfo' in dct and dct['cacheinfo']:
+ if dct.get('cacheinfo'):
bases = cls.add_base(bases, CacheInfoMixin)
- if 'cached' in dct and dct['cached']:
+ if dct.get('cached'):
bases = cls.add_base(bases, ForceCacheMixin)
- if 'net' in dct and dct['net']:
+ if dct.get('net'):
bases = cls.add_base(bases, CheckHostnameMixin)
else:
assert not hostnames, 'net must be True with hostnames defined'
- if 'write' in dct and dct['write']:
- if 'user' not in dct:
- dct['user'] = True
+ if dct.get('write'):
+ dct.setdefault('user', True)
bases = cls.add_base(bases, SiteWriteMixin)
- if (('user' in dct and dct['user'])
- or ('sysop' in dct and dct['sysop'])):
+ if dct.get('user') or dct.get('sysop'):
bases = cls.add_base(bases, RequireUserMixin)
for test in tests:
@@ -977,7 +974,7 @@
interface = DrySite
for data in cls.sites.values():
- if ('code' in data and data['code'] in ('test', 'mediawiki')
+ if (data.get('code') in ('test', 'mediawiki')
and 'PYWIKIBOT_TEST_PROD_ONLY' in os.environ and not dry):
raise unittest.SkipTest(
'Site code "{}" and PYWIKIBOT_TEST_PROD_ONLY is set.'
--
To view, visit https://gerrit.wikimedia.org/r/569319
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: I925ef5a6a2f09aabbe6acaa9f8829e41f60f18bb
Gerrit-Change-Number: 569319
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/553843 )
Change subject: [cleanup] Remove unused deprecated filterParents function
......................................................................
[cleanup] Remove unused deprecated filterParents function
Patch 3 detached from I28d72f2
Bug: T195079
Bug: T78462
Change-Id: Iab2ddc3d1c764b14f3bf4109547061d2f6c4f478
---
M scripts/imagerecat.py
1 file changed, 1 insertion(+), 16 deletions(-)
Approvals:
D3r1ck01: Looks good to me, but someone else must approve
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/imagerecat.py b/scripts/imagerecat.py
index d4db6aa..824b163 100755
--- a/scripts/imagerecat.py
+++ b/scripts/imagerecat.py
@@ -22,7 +22,6 @@
import pywikibot
from pywikibot import pagegenerators, textlib
-from pywikibot.tools import deprecated
category_blacklist = []
@@ -131,9 +130,7 @@
First make a list of any ...by country categories and try to find some
countries. If a by country category has a subcategoy containing one of the
- countries found, add it. The ...by country categories remain in the set and
- should be filtered out by filterParents.
-
+ countries found, add it. The ...by country categories remain in the set.
"""
result = categories
listByCountry = []
@@ -159,18 +156,6 @@
return list(set(result))
-@deprecated(since='20180120')
-def filterParents(categories):
- """
- Remove all parent categories from the set to prevent overcategorization.
-
- DEPRECATED: Toolserver script isn't available anymore (T78462).
- This method is kept for compatibility and may be restored sometime by a new
- implementation.
- """
- return categories
-
-
def saveImagePage(imagepage, newcats):
"""Remove the old categories and add the new categories to the image."""
newtext = textlib.removeCategoryLinks(imagepage.text, imagepage.site)
--
To view, visit https://gerrit.wikimedia.org/r/553843
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: Iab2ddc3d1c764b14f3bf4109547061d2f6c4f478
Gerrit-Change-Number: 553843
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
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/570865 )
Change subject: [docs] Fix newly occurring doc warning
......................................................................
[docs] Fix newly occurring doc warning
Change-Id: I25f9ab0f322fda8336f5b19ef704c215f147060e
---
M pywikibot/site.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 6c17139..345ecaa 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -7713,7 +7713,8 @@
"""
Return a new instance for given entity id.
- @raises NoWikibaseEntity: there is no entity with the id
+ @raises pywikibot.exceptions.NoWikibaseEntity: there is no entity
+ with the id
@return: a WikibaseEntity subclass
@rtype: WikibaseEntity
"""
--
To view, visit https://gerrit.wikimedia.org/r/570865
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: I25f9ab0f322fda8336f5b19ef704c215f147060e
Gerrit-Change-Number: 570865
Gerrit-PatchSet: 2
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
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/570867 )
Change subject: [bugfix] Fix as_filename for Windows
......................................................................
[bugfix] Fix as_filename for Windows
- MediaWiki:
https://www.mediawiki.org/wiki/Manual:$wgIllegalFileChars
- Windows:
https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
Bug: T236614
Change-Id: Ia43e81b87ee0d088dfad5be4808086816425be78
---
M pywikibot/page.py
1 file changed, 5 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index aea88fa..b730794 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -373,9 +373,12 @@
title = quote_from_bytes(encoded_title, safe='')
if as_filename:
# Replace characters that are not possible in file names on some
- # systems.
+ # systems, but still are valid in MediaWiki titles:
+ # Unix: /
+ # MediaWiki: /:\
+ # Windows: /:\"?*
# Spaces are possible on most systems, but are bad for URLs.
- for forbidden in ':*?/\\ ':
+ for forbidden in ':*?/\\" ':
title = title.replace(forbidden, '_')
return title
--
To view, visit https://gerrit.wikimedia.org/r/570867
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: Ia43e81b87ee0d088dfad5be4808086816425be78
Gerrit-Change-Number: 570867
Gerrit-PatchSet: 7
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
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/569306 )
Change subject: [tests] Use Python 3.6 instead of 3.4 for tests
......................................................................
[tests] Use Python 3.6 instead of 3.4 for tests
Use default Python which is 3.6.7 currently
to hide FutureWarning about deprecated Python version.
Change-Id: Ie94277e2e8824bb284465cffe2654a90276d3847
---
M .travis.yml
1 file changed, 0 insertions(+), 5 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.travis.yml b/.travis.yml
index 0cbc4b5..90695e8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,10 +1,5 @@
language: python
-sudo: false
-
-python:
- - '3.4'
-
env:
- PYWIKIBOT2_NO_USER_CONFIG=2
--
To view, visit https://gerrit.wikimedia.org/r/569306
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/i18n
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie94277e2e8824bb284465cffe2654a90276d3847
Gerrit-Change-Number: 569306
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/569350 )
Change subject: Add meta to clean_sandbox.py config
......................................................................
Add meta to clean_sandbox.py config
Bug: T244077
Change-Id: I6555c718fe6646bb5630fee2f45f7b1d96f9e4e4
---
M scripts/clean_sandbox.py
1 file changed, 2 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/clean_sandbox.py b/scripts/clean_sandbox.py
index 82baf9e..8d16d9d 100755
--- a/scripts/clean_sandbox.py
+++ b/scripts/clean_sandbox.py
@@ -48,6 +48,8 @@
content = {
'commons': '{{Sandbox}}\n<!-- Please edit only below this line. -->',
+ 'meta': '{{Meta:Sandbox/Please do not edit this line}}'
+ '<!--Please edit below this line.-->',
'test': '<noinclude>{{Sandbox}}</noinclude>\n'
'== Please start your testing below this line ==',
'wikidata': '{{Please leave this line alone (sandbox heading)}}',
--
To view, visit https://gerrit.wikimedia.org/r/569350
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: I6555c718fe6646bb5630fee2f45f7b1d96f9e4e4
Gerrit-Change-Number: 569350
Gerrit-PatchSet: 2
Gerrit-Owner: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)