jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/463455 )
Change subject: [doc] Add a common help string to flickrripper.py
......................................................................
[doc] Add a common help string to flickrripper.py
- remove usage() function
- move comments to related functions
- show error messages and warnings when needed
Bug: T199094
Change-Id: I7bd590f3226cd3eef1fdb915af33a1b122528aa5
---
M scripts/flickrripper.py
M tests/script_tests.py
M tox.ini
3 files changed, 55 insertions(+), 59 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/flickrripper.py b/scripts/flickrripper.py
index 61310db..1bd3ff5 100755
--- a/scripts/flickrripper.py
+++ b/scripts/flickrripper.py
@@ -1,21 +1,20 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
-Tool to copy a flickr stream to Commons.
+A tool to transfer flickr photos to Wikimedia Commons.
-# Get a set to work on (start with just a username).
- * Make it possible to delimit the set (from/to)
-# For each image
- * Check the license
- * Check if it isn't already on Commons
- * Build suggested filename
- * Check for name collision and maybe alter it
- * Pull description from Flinfo
- * Show image and description to user
- * Add a nice hotcat lookalike for the adding of categories
- * Filter the categories
- * Upload the image
-
+ -group_id: specify group ID of the pool
+ -photoset_id: specify a photoset id
+ -user_id: give the user id of the flickrriper user
+ -start_id: the photo id to start with
+ -end_id: the photo id to end with
+ -tags: a tag to filter photo items (only one is supported)
+ -flickerreview add a flickr review template to the description
+ -reviewer: specify the reviewer
+ -override: override text for licence
+ -addcategory: specify a category
+ -removecategories remove all categories
+ -autonomous run bot in autonomous mode
"""
#
# (C) Multichill, 2009
@@ -47,12 +46,9 @@
from urllib import urlencode
try:
- import flickrapi # see: http://stuvel.eu/projects/flickrapi
+ import flickrapi # see: http://stuvel.eu/projects/flickrapi
except ImportError as e:
- print('This script requires the python flickrapi module. \n'
- 'See: http://stuvel.eu/projects/flickrapi')
- print(e)
- sys.exit(1)
+ flickrapi = e
flickr_allowed_license = {
@@ -271,7 +267,19 @@
def processPhoto(flickr, photo_id='', flickrreview=False, reviewer='',
override='', addCategory='', removeCategories=False,
autonomous=False):
- """Process a single Flickr photo."""
+ """Process a single Flickr photo.
+
+ For each image:
+ * Check the license
+ * Check if it isn't already on Commons
+ * Build suggested filename
+ * Check for name collision and maybe alter it
+ * Pull description from Flinfo
+ * Show image and description to user
+ * Add a nice hotcat lookalike for the adding of categories
+ * Filter the categories
+ * Upload the image
+ """
if photo_id:
pywikibot.output(str(photo_id))
(photoInfo, photoSizes) = getPhoto(flickr, photo_id)
@@ -331,7 +339,11 @@
def getPhotos(flickr, user_id='', group_id='', photoset_id='',
start_id='', end_id='', tags=''):
- """Loop over a set of Flickr photos."""
+ """Loop over a set of Flickr photos.
+
+ Get a set to work on (start with just a username).
+ * Make it possible to delimit the set (from/to)
+ """
found_start_id = not start_id
# https://www.flickr.com/services/api/flickr.groups.pools.getPhotos.html
@@ -386,21 +398,6 @@
return
-def usage():
- """
- Print usage information.
-
- TODO : Need more.
- """
- pywikibot.output('Flickrripper is a tool to transfer flickr photos to '
- 'Wikimedia Commons')
- pywikibot.output('-group_id:<group_id>\n')
- pywikibot.output('-photoset_id:<photoset_id>\n')
- pywikibot.output('-user_id:<user_id>\n')
- pywikibot.output('-tags:<tag>\n')
- return
-
-
def main(*args):
"""
Process command line arguments and invoke bot.
@@ -412,21 +409,6 @@
"""
local_args = pywikibot.handle_args(args)
- # Get the api key
- if not config.flickr['api_key']:
- pywikibot.output('Flickr api key not found! Get yourself an api key')
- pywikibot.output(
- 'Any flickr user can get a key at '
- 'https://www.flickr.com/services/api/keys/apply/')
- return
-
- if 'api_secret' in config.flickr and config.flickr['api_secret']:
- flickr = flickrapi.FlickrAPI(config.flickr['api_key'],
- config.flickr['api_secret'])
- else:
- pywikibot.output('Accessing public content only')
- flickr = flickrapi.FlickrAPI(config.flickr['api_key'])
-
group_id = ''
photoset_id = ''
user_id = ''
@@ -517,18 +499,32 @@
elif arg == '-autonomous':
autonomous = True
- if user_id or group_id or photoset_id:
+ if isinstance(flickrapi, Exception):
+ pywikibot.error('This script requires the python flickrapi module. \n'
+ 'See: http://stuvel.eu/projects/flickrapi')
+
+ elif not config.flickr['api_key']:
+ pywikibot.warning('Flickr api key not found! Get yourself an api key\n'
+ 'Any flickr user can get a key at\n'
+ 'https://www.flickr.com/services/api/keys/apply/')
+
+ elif user_id or group_id or photoset_id:
+ if 'api_secret' in config.flickr and config.flickr['api_secret']:
+ flickr = flickrapi.FlickrAPI(config.flickr['api_key'],
+ config.flickr['api_secret'])
+ else:
+ pywikibot.output('Accessing public content only')
+ flickr = flickrapi.FlickrAPI(config.flickr['api_key'])
+
for photo_id in getPhotos(flickr, user_id, group_id, photoset_id,
start_id, end_id, tags):
uploadedPhotos += processPhoto(flickr, photo_id, flickrreview,
reviewer, override, addCategory,
removeCategories, autonomous)
totalPhotos += 1
- else:
- usage()
- pywikibot.output('Finished running')
- pywikibot.output('Total photos: ' + str(totalPhotos))
- pywikibot.output('Uploaded photos: ' + str(uploadedPhotos))
+ pywikibot.output('Finished running')
+ pywikibot.output('Total photos: ' + str(totalPhotos))
+ pywikibot.output('Uploaded photos: ' + str(uploadedPhotos))
if __name__ == '__main__':
diff --git a/tests/script_tests.py b/tests/script_tests.py
index af9e37b..735336a 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -376,6 +376,7 @@
_expected_failures = failed_dep_script_set
# -help tests may pass even when packages are required
+ _expected_failures.discard('flickrripper')
_expected_failures.discard('imageharvest')
_expected_failures.discard('isbn')
_expected_failures.discard('weblinkchecker')
@@ -402,7 +403,6 @@
_expected_failures = {
'catall', # stdout user interaction
- 'flickrripper', # Requires a flickr api key
'upload', # raises custom ValueError
}.union(failed_dep_script_set)
diff --git a/tox.ini b/tox.ini
index 2ab13a8..02de60f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -202,7 +202,7 @@
scripts/commonscat.py : N803, N806, N802
scripts/data_ingestion.py : N803, N806, N802
scripts/fixing_redirects.py : N803, N806
- scripts/flickrripper.py : T001, N803, N806, N802
+ scripts/flickrripper.py : N803, N806, N802
scripts/freebasemappingupload.py: N802
scripts/harvest_template.py : T001, N802
scripts/imagecopy.py : N801, N803, N806, N802
--
To view, visit https://gerrit.wikimedia.org/r/463455
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: I7bd590f3226cd3eef1fdb915af33a1b122528aa5
Gerrit-Change-Number: 463455
Gerrit-PatchSet: 5
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Multichill <maarten(a)mdammers.nl>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/467645 )
Change subject: [compat] do not actively support compat module
......................................................................
[compat] do not actively support compat module
core branch is now 11 years old and decommission of compat was two years
ago. The compat module was created in 2012 and older catlib and userlib
where merged into that folder in 2014.
The framework was never using this compatibility module and bot operators
get a deprecation warning for their private scripts when the module is
used. The scripts should be updated accordingly.
- remove their references from autogenerated docs to not actively support it
- update compat2core.py maintenance script
detached from I32cd9ca2d1e
Bug: T183085
Change-Id: I9d61e1eb0d26e570406b14ee28b0cd86a2a49871
---
M docs/api_ref/pywikibot.rst
M scripts/maintenance/compat2core.py
2 files changed, 4 insertions(+), 3 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/api_ref/pywikibot.rst b/docs/api_ref/pywikibot.rst
index b111780..d8878f0 100644
--- a/docs/api_ref/pywikibot.rst
+++ b/docs/api_ref/pywikibot.rst
@@ -12,7 +12,6 @@
.. toctree::
pywikibot.comms
- pywikibot.compat
pywikibot.data
pywikibot.families
pywikibot.tools
diff --git a/scripts/maintenance/compat2core.py b/scripts/maintenance/compat2core.py
index c4b64ce..4ae4e2c 100755
--- a/scripts/maintenance/compat2core.py
+++ b/scripts/maintenance/compat2core.py
@@ -50,9 +50,8 @@
('import wikipedia(?: as pywikibot)?', 'import pywikibot'),
('(?<!from pywikibot )import (config|pagegenerators)',
r'from pywikibot import \1'),
- ('(?<!from pywikibot.compat )import query',
- 'from pywikibot.compat import query'),
# remove deprecated libs
+ ('(?:from pywikibot.compat )?import query', ''),
('import catlib\r?\n', ''),
('import userlib\r?\n', ''),
# change wikipedia to pywikibot, exclude URLs
@@ -112,6 +111,9 @@
('from wikipedia import',
'"wikipedia" library has been changed to "pywikibot". Please find the\n'
'right way to import your object.'),
+ ('from pywikibot.compat import',
+ 'compat module has been dropped. Please refer README-conversion.txt for\n'
+ 'core implementation.'),
('query.GetData(',
'query.GetData() should be replaced by pywikibot.data.api.Request or\n'
'by a direct site request'),
--
To view, visit https://gerrit.wikimedia.org/r/467645
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: I9d61e1eb0d26e570406b14ee28b0cd86a2a49871
Gerrit-Change-Number: 467645
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Multichill <maarten(a)mdammers.nl>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/473749 )
Change subject: [PEP8] Fix W504 errors in pywikibot/site.py script
......................................................................
[PEP8] Fix W504 errors in pywikibot/site.py script
Fixed the W504 error occurences in the mentioned file.
Bug: T207836
Change-Id: I011c00d246c59fb6e29032909762a5cd654fed64
---
M pywikibot/site.py
1 file changed, 31 insertions(+), 31 deletions(-)
Approvals:
Framawiki: Looks good to me, but someone else must approve
D3r1ck01: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 8033eeb..c5691d2 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -1787,8 +1787,8 @@
"Requested token '{0}' is invalid on {1} wiki."
.format(key, self.site))
- if (key not in user_tokens and
- failed_cache_key not in self.failed_cache):
+ if (key not in user_tokens
+ and failed_cache_key not in self.failed_cache):
self.load_tokens([key], all=False if user_tokens else None)
if key in user_tokens:
@@ -2281,11 +2281,12 @@
"""Validate iterating API parameters."""
if reverse:
if end < start:
- raise Error(msg_prefix +
- ': end must be later than start with reverse=True')
+ raise Error(msg_prefix
+ + ': end must be later than start'
+ ' with reverse=True')
elif start < end:
- raise Error(msg_prefix +
- ': start must be later than end with reverse=False')
+ raise Error(msg_prefix
+ + ': start must be later than end with reverse=False')
def has_right(self, right, sysop=False):
"""Return true if and only if the user has a specific right.
@@ -2901,9 +2902,9 @@
self._proofread_page_ns and self._proofread_levels.
@rtype: Namespace, Namespace, dict
"""
- if (not hasattr(self, '_proofread_index_ns') or
- not hasattr(self, '_proofread_page_ns') or
- not hasattr(self, '_proofread_levels')):
+ if (not hasattr(self, '_proofread_index_ns')
+ or not hasattr(self, '_proofread_page_ns')
+ or not hasattr(self, '_proofread_levels')):
pirequest = self._request(
expiry=pywikibot.config.API_config_expiry
@@ -3475,9 +3476,9 @@
'type')['type']
valid_types = [token for token in types if token in types_wiki]
for token in types:
- if (token not in valid_types and
- (token in types_wiki_old or
- token in types_wiki_action)):
+ if (token not in valid_types
+ and (token in types_wiki_old or token
+ in types_wiki_action)):
valid_types.append('csrf')
return valid_types
@@ -4056,16 +4057,16 @@
@raises ValueError: invalid startid/endid or starttime/endtime values
@raises pywikibot.Error: revids belonging to a different page
"""
- latest = (revids is None and
- startid is None and
- endid is None and
- starttime is None and
- endtime is None and
- rvdir is None and
- user is None and
- excludeuser is None and
- step is None and
- total is None) # if True, retrieving current revision
+ latest = (revids is None
+ and startid is None
+ and endid is None
+ and starttime is None
+ and endtime is None
+ and rvdir is None
+ and user is None
+ and excludeuser is None
+ and step is None
+ and total is None) # if True, retrieving current revision
# check for invalid argument combinations
if (startid is not None or endid is not None) and \
@@ -4985,8 +4986,8 @@
drprop='revid|user|comment|minor',
total=total)
if content:
- drgen.request['drprop'] = (drgen.request['drprop'] +
- ['content', 'token'])
+ drgen.request['drprop'] = (drgen.request['drprop']
+ + ['content', 'token'])
if start is not None:
drgen.request['drstart'] = start
if end is not None:
@@ -6251,8 +6252,8 @@
assert offset is False or file_size is not None
if _verify_stash is None:
_verify_stash = True
- if (offset is not False and offset is not True and
- offset > file_size):
+ if (offset is not False and offset is not True
+ and offset > file_size):
raise ValueError(
'For the file key "{0}" the offset was set to {1} '
'while the file is only {2} bytes large.'.format(
@@ -7579,8 +7580,8 @@
# _get_propertyitem
def _get_item(self, source, **params):
assert set(params) <= {'props'}, \
- 'Only "props" is a valid kwarg, not {0}'.format(set(params) -
- {'props'})
+ 'Only "props" is a valid kwarg, not {0}'.format(set(params)
+ - {'props'})
if isinstance(source, int) or \
isinstance(source, basestring) and source.isdigit():
ids = 'q' + str(source)
@@ -7939,9 +7940,8 @@
'baserevid': self._get_baserevid(claim, baserevid),
'summary': summary, 'bot': bot}
- if (not new and
- hasattr(qualifier, 'hash') and
- qualifier.hash is not None):
+ if (not new and hasattr(qualifier, 'hash')
+ and qualifier.hash is not None):
params['snakhash'] = qualifier.hash
params['token'] = self.tokens['edit']
# build up the snak
--
To view, visit https://gerrit.wikimedia.org/r/473749
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: I011c00d246c59fb6e29032909762a5cd654fed64
Gerrit-Change-Number: 473749
Gerrit-PatchSet: 8
Gerrit-Owner: Nathan fraignt <nathanklumpenaar10(a)outlook.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Nathan fraignt <nathanklumpenaar10(a)outlook.com>
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/473848 )
Change subject: [fix] Return None in LoginManager.getCookie()
......................................................................
[fix] Return None in LoginManager.getCookie()
- Du to pep8 an explicit return statement should be present in a function
- Simplify site assingment (update from compat)
- Simplify continuous if statements
- Use single quotes in Example
Bug: T209193
Change-Id: I8ceae91cec9f009d8f8e3b45391100fa5722f5bc
---
M pywikibot/login.py
1 file changed, 12 insertions(+), 14 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/login.py b/pywikibot/login.py
index 0f54a60..73dfad5 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -82,10 +82,7 @@
@raises NoUsername: No username is configured for the requested site.
"""
- if site is not None:
- self.site = site
- else:
- self.site = pywikibot.Site()
+ self.site = site or pywikibot.Site()
if user:
self.username = user
elif sysop:
@@ -193,7 +190,8 @@
@return: cookie data if successful, None otherwise.
"""
- # NOT IMPLEMENTED - see data/api.py for implementation
+ # THIS IS OVERRIDDEN IN data/api.py
+ return None
def storecookiedata(self, data):
"""
@@ -230,12 +228,12 @@
Example::
- ("my_username", "my_default_password")
- ("my_sysop_user", "my_sysop_password")
- ("wikipedia", "my_wikipedia_user", "my_wikipedia_pass")
- ("en", "wikipedia", "my_en_wikipedia_user", "my_en_wikipedia_pass")
- ("my_username", BotPassword(
- "my_BotPassword_suffix", "my_BotPassword_password"))
+ ('my_username', 'my_default_password')
+ ('my_sysop_user', 'my_sysop_password')
+ ('wikipedia', 'my_wikipedia_user', 'my_wikipedia_pass')
+ ('en', 'wikipedia', 'my_en_wikipedia_user', 'my_en_wikipedia_pass')
+ ('my_username', BotPassword(
+ 'my_BotPassword_suffix', 'my_BotPassword_password'))
"""
# Set path to password file relative to the user_config
# but fall back on absolute path for backwards compatibility
@@ -316,14 +314,14 @@
if e.code == 'NotExists':
raise NoUsername("Username '%s' does not exist on %s"
% (self.login_name, self.site))
- elif e.code == 'Illegal':
+ if e.code == 'Illegal':
raise NoUsername("Username '%s' is invalid on %s"
% (self.login_name, self.site))
- elif e.code == 'readapidenied':
+ if e.code == 'readapidenied':
raise NoUsername(
'Username "{0}" does not have read permissions on '
'{1}'.format(self.login_name, self.site))
- elif e.code == 'Failed':
+ if e.code == 'Failed':
raise NoUsername(
'Username "{0}" does not have read permissions on '
'{1}\n.{2}'.format(self.login_name, self.site, e.info))
--
To view, visit https://gerrit.wikimedia.org/r/473848
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: I8ceae91cec9f009d8f8e3b45391100fa5722f5bc
Gerrit-Change-Number: 473848
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
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/473940 )
Change subject: [FIX] site.preloadpages: split pagelist in at most max_ids elements
......................................................................
[FIX] site.preloadpages: split pagelist in at most max_ids elements
In site.preloadpages(), max_ids, i.e. the API query limit is
computed after pagelist has been splitted in chunks of groupsize
elements.
Pagelist shall be splitted in chunks of min(groupsize, max_ids)
elements.
Bug: T209111
Change-Id: I7ae76e26d2500cc8abea679b5e80465fb07690c9
---
M pywikibot/site.py
1 file changed, 7 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 8033eeb..58fb89f 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3370,7 +3370,13 @@
rvprop = ['ids', 'flags', 'timestamp', 'user', 'comment', 'content']
- for sublist in itergroup(pagelist, groupsize):
+ parameter = self._paraminfo.parameter('query+info', 'prop')
+ if self.logged_in() and self.has_right('apihighlimits'):
+ max_ids = int(parameter['highlimit'])
+ else:
+ max_ids = int(parameter['limit']) # T78333, T161783
+
+ for sublist in itergroup(pagelist, min(groupsize, max_ids)):
# Do not use p.pageid property as it will force page loading.
pageids = [str(p._pageid) for p in sublist
if hasattr(p, '_pageid') and p._pageid > 0]
@@ -3388,12 +3394,6 @@
rvgen = api.PropertyGenerator(props, site=self)
rvgen.set_maximum_items(-1) # suppress use of "rvlimit" parameter
- parameter = self._paraminfo.parameter('query+info', 'prop')
- if self.logged_in() and self.has_right('apihighlimits'):
- max_ids = int(parameter['highlimit'])
- else:
- max_ids = int(parameter['limit']) # T78333, T161783
-
if len(pageids) == len(sublist) and len(set(pageids)) <= max_ids:
# only use pageids if all pages have them
rvgen.request['pageids'] = set(pageids)
--
To view, visit https://gerrit.wikimedia.org/r/473940
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: I7ae76e26d2500cc8abea679b5e80465fb07690c9
Gerrit-Change-Number: 473940
Gerrit-PatchSet: 2
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
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/473747 )
Change subject: [bugfix] Disable empty sections cc in userspace
......................................................................
[bugfix] Disable empty sections cc in userspace
User sandbox can contain multiple empty sections of newly prepared
article stub. But users don't use nobots/in-use templates
in their userspace, therefore bots should not remove these empty
sections from the page.
Change-Id: I7a588887b24954ebcb8a8a5295b4b84929c4c2ea
---
M pywikibot/cosmetic_changes.py
1 file changed, 4 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index 01fbcdf..7b389a4 100755
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -662,6 +662,10 @@
def removeEmptySections(self, text):
"""Cleanup empty sections."""
+ # userspace contains article stubs without nobots/in use templates
+ if self.namespace == 2:
+ return text
+
skippings = ['comment', 'category']
skip_regexes = _get_regexes(skippings, self.site)
# site defined templates
--
To view, visit https://gerrit.wikimedia.org/r/473747
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: I7a588887b24954ebcb8a8a5295b4b84929c4c2ea
Gerrit-Change-Number: 473747
Gerrit-PatchSet: 3
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.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: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)