jenkins-bot has submitted this change and it was merged.
Change subject: [bugfix] Fix argument parsing for logevents
......................................................................
[bugfix] Fix argument parsing for logevents
- arg must not end with ':'
- additional parameters of old <mode>log option is fetched by preparsed value
Change-Id: Iaf0621567af9ab874f6311864d90362d9a2c438a
---
M pywikibot/pagegenerators.py
1 file changed, 12 insertions(+), 13 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 521dd98..498d00e 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -823,34 +823,33 @@
'Maximum subpage depth:')
self.subpage_max_depth = int(value)
return True
- elif arg == '-logevents:':
+ elif arg == '-logevents':
gen = self._parse_log_events(*value.split(','))
elif arg.startswith('-'):
- mode, log, user = arg.partition('log')
+ mode, log, tail = arg.partition('log')
# exclude -log, -nolog
- if log == 'log' and mode not in ['-', '-no']:
+ if log == 'log' and mode not in ['-', '-no'] and not tail:
mode = mode[1:]
- user = user[1:]
total = 500
- if user:
+ if value:
try:
- total = int(user)
+ total = int(value)
except:
- params = user.split(';')
+ params = value.split(';')
if len(params) == 2:
- user, total = params
+ value, total = params
else:
- user = params[0]
+ value = params[0]
else:
- user = None
+ value = None
else:
- user = None
+ value = None
issue_deprecation_warning(
'The usage of "{0}"'.format(arg),
'-logevents:"{0}"'.format(
- ','.join((mode, user or '', str(total)))),
+ ','.join((mode, value or '', str(total)))),
2, ArgumentDeprecationWarning)
- gen = self._parse_log_events(mode, user, total)
+ gen = self._parse_log_events(mode, value, total)
if gen:
self.gens.append(gen)
--
To view, visit https://gerrit.wikimedia.org/r/269858
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaf0621567af9ab874f6311864d90362d9a2c438a
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Reduce line length to 100 characters
......................................................................
Reduce line length to 100 characters
This reduces the line length of all files to at most 100 characters.
Change-Id: Ia45d36ea51fd0e69f0a7407fbea83b4e13b56e44
---
M pywikibot/cosmetic_changes.py
M pywikibot/family.py
M pywikibot/page.py
M scripts/cfd.py
M scripts/claimit.py
M scripts/imagecopy.py
M scripts/imagecopy_self.py
M scripts/panoramiopicker.py
M tests/namespace_tests.py
M tox.ini
10 files changed, 271 insertions(+), 175 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
Xqt: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index bf16474..e623e46 100755
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -384,7 +384,8 @@
# TODO: Taking main cats to top
# for name in categories:
- # if re.search(u"(.+?)\|(.{,1}?)",name.title()) or name.title()==name.title().split(":")[0]+title:
+ # if (re.search(u"(.+?)\|(.{,1}?)",name.title()) or
+ # name.title() == name.title().split(":")[0] + title):
# categories.remove(name)
# categories.insert(0, name)
text = textlib.replaceCategoryLinks(text, categories,
@@ -606,7 +607,8 @@
# group <linktrail> is the link trail after ]] which are part of the word.
# note that the definition of 'letter' varies from language to language.
linkR = re.compile(
- r'(?P<newline>[\n]*)\[\[(?P<titleWithSection>[^\]\|]+)(\|(?P<label>[^\]\|]*))?\]\](?P<linktrail>' +
+ r'(?P<newline>[\n]*)\[\[(?P<titleWithSection>[^\]\|]+)'
+ r'(\|(?P<label>[^\]\|]*))?\]\](?P<linktrail>' +
self.site.linktrail() + ')')
text = textlib.replaceExcept(text, linkR, handleOneLink,
diff --git a/pywikibot/family.py b/pywikibot/family.py
index bdfaca3..f430048 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -914,12 +914,6 @@
myfamily = AutoFamily(fam, family_file)
Family._families[fam] = myfamily
return Family._families[fam]
- elif fam == 'lockwiki':
- raise UnknownFamily(
- "Family 'lockwiki' has been removed as it not a public wiki.\n"
- "You may install your own family file for this wiki, and a "
- "old family file may be found at:\n"
- "http://git.wikimedia.org/commitdiff/pywikibot%2Fcore.git/dfdc0c9150fa8e0982…")
try:
# Ignore warnings due to dots in family names.
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 0349676..8e6f4c2 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2390,8 +2390,8 @@
comment = info['comment']
lines.append(u'| %s || %s || %s || %s || <nowiki>%s</nowiki>'
% (datetime, username, resolution, size, comment))
- return u'{| border="1"\n! date/time || username || resolution || size || edit summary\n|----\n' + \
- u'\n|----\n'.join(lines) + '\n|}'
+ return ('{| border="1"\n! date/time || username || resolution || size '
+ '|| edit summary\n|----\n\n|----\n'.join(lines) + '\n|}')
def usingPages(self, step=None, total=None, content=False):
"""
diff --git a/scripts/cfd.py b/scripts/cfd.py
index 849cfb6..63ca86b 100755
--- a/scripts/cfd.py
+++ b/scripts/cfd.py
@@ -125,11 +125,13 @@
dest = m.result.group(2)
thisDay = findDay(src, day)
if mode == "Move" and thisDay != "None":
- summary = "Robot - Moving category " + src + " to [[:Category:" + dest + "]] per [[WP:CFD|CFD]] at " + \
- thisDay + "."
+ summary = (
+ 'Robot - Moving category ' + src + ' to [[:Category:' +
+ dest + ']] per [[WP:CFD|CFD]] at ' + thisDay + '.')
elif mode == "Speedy":
- summary = "Robot - Speedily moving category " + src + " to [[:Category:" + dest + \
- "]] per [[WP:CFDS|CFDS]]."
+ summary = (
+ 'Robot - Speedily moving category ' + src +
+ ' to [[:Category:' + dest + ']] per [[WP:CFDS|CFDS]].')
else:
continue
# If the category is redirect, we do NOT want to move articles to
@@ -148,19 +150,22 @@
deletion_comment=True)
elif m.check(deletecat, line):
src = m.result.group(1)
- # I currently don't see any reason to handle these two cases separately, though
- # if are guaranteed that the category in the "Delete" case is empty, it might be
- # easier to call delete.py on it.
+ # I currently don't see any reason to handle these two cases
+ # separately, though if are guaranteed that the category in the
+ # "Delete" case is empty, it might be easier to call delete.py on
+ # it.
thisDay = findDay(src, day)
if (mode == "Empty" or mode == "Delete") and thisDay != "None":
- summary = 'Robot - Removing category {0} per [[WP:CFD|CFD]] at {1}.'.format(
- src, thisDay)
+ summary = (
+ 'Robot - Removing category {0} per [[WP:CFD|CFD]] '
+ 'at {1}.'.format(src, thisDay))
else:
continue
robot = CategoryMoveBot(oldcat=src, batch=True, comment=summary,
deletion_comment=True, inplace=True)
else:
- # This line does not fit any of our regular expressions, so ignore it.
+ # This line does not fit any of our regular expressions,
+ # so ignore it.
pass
if summary != "" and robot is not None:
pywikibot.output(summary, toStdout=True)
diff --git a/scripts/claimit.py b/scripts/claimit.py
index 93a7a4d..cd2993c 100755
--- a/scripts/claimit.py
+++ b/scripts/claimit.py
@@ -101,26 +101,44 @@
# If claim with same property already exists...
if claim.getID() in item.claims:
if self.exists_arg is None or 'p' not in self.exists_arg:
- pywikibot.log('Skipping %s because claim with same property already exists' % (claim.getID(),))
- pywikibot.log('Use the -exists:p option to override this behavior')
+ pywikibot.log(
+ 'Skipping %s because claim with same property '
+ 'already exists' % (claim.getID(),))
+ pywikibot.log(
+ 'Use -exists:p option to override this behavior')
skip = True
else:
- existing_claims = item.claims[claim.getID()] # Existing claims on page of same property
+ # Existing claims on page of same property
+ existing_claims = item.claims[claim.getID()]
for existing in existing_claims:
skip = True # Default value
- # If some attribute of the claim being added matches some attribute in an existing claim
- # of the same property, skip the claim, unless the 'exists' argument overrides it.
- if claim.getTarget() == existing.getTarget() and 't' not in self.exists_arg:
- pywikibot.log('Skipping %s because claim with same target already exists' % (claim.getID(),))
- pywikibot.log('Append \'t\' to the -exists argument to override this behavior')
+ # If some attribute of the claim being added
+ # matches some attribute in an existing claim of
+ # the same property, skip the claim, unless the
+ # 'exists' argument overrides it.
+ if (claim.getTarget() == existing.getTarget() and
+ 't' not in self.exists_arg):
+ pywikibot.log(
+ 'Skipping %s because claim with same target already exists'
+ % (claim.getID(),))
+ pywikibot.log(
+ 'Append \'t\' to -exists argument to override this behavior')
break
- if listsEqual(claim.getSources(), existing.getSources()) and 's' not in self.exists_arg:
- pywikibot.log('Skipping %s because claim with same sources already exists' % (claim.getID(),))
- pywikibot.log('Append \'s\' to the -exists argument to override this behavior')
+ if (listsEqual(claim.getSources(), existing.getSources()) and
+ 's' not in self.exists_arg):
+ pywikibot.log(
+ 'Skipping %s because claim with same sources already exists'
+ % (claim.getID(),))
+ pywikibot.log(
+ 'Append \'s\' to -exists argument to override this behavior')
break
- if listsEqual(claim.qualifiers, existing.qualifiers) and 'q' not in self.exists_arg:
- pywikibot.log('Skipping %s because claim with same qualifiers already exists' % (claim.getID(),))
- pywikibot.log('Append \'q\' to the -exists argument to override this behavior')
+ if (listsEqual(claim.qualifiers, existing.qualifiers) and
+ 'q' not in self.exists_arg):
+ pywikibot.log(
+ 'Skipping %s because claim with same '
+ 'qualifiers already exists' % (claim.getID(),))
+ pywikibot.log(
+ 'Append \'q\' to -exists argument to override this behavior')
break
skip = False
if not skip:
diff --git a/scripts/imagecopy.py b/scripts/imagecopy.py
index 0450fc7..d1b5d6f 100644
--- a/scripts/imagecopy.py
+++ b/scripts/imagecopy.py
@@ -254,7 +254,8 @@
def run(self):
tosend = {'language': self.imagePage.site.language().encode('utf-8'),
- 'image': self.imagePage.title(withNamespace=False).encode('utf-8'),
+ 'image': self.imagePage.title(
+ withNamespace=False).encode('utf-8'),
'newname': self.newname.encode('utf-8'),
'project': self.imagePage.site.family.name.encode('utf-8'),
'username': '',
@@ -276,20 +277,23 @@
CH = self.fixAuthor(CH)
pywikibot.output(CH)
- # I want every picture to be tagged with the bottemplate so i can check my contributions later.
- CH = u'\n\n{{BotMoveToCommons|' + self.imagePage.site.language() + \
- '.' + self.imagePage.site.family.name + \
- '|year={{subst:CURRENTYEAR}}|month={{subst:CURRENTMONTHNAME}}|day={{subst:CURRENTDAY}}}}' + \
- CH
+ # I want every picture to be tagged with the bottemplate so i can check
+ # my contributions later.
+ CH = ('\n\n{{BotMoveToCommons|' + self.imagePage.site.language() +
+ '.' + self.imagePage.site.family.name +
+ '|year={{subst:CURRENTYEAR}}|month={{subst:CURRENTMONTHNAME}}'
+ '|day={{subst:CURRENTDAY}}}}' + CH)
if self.category:
- CH = CH.replace(u'{{subst:Unc}} <!-- Remove this line once you have added categories -->', u'')
+ CH = CH.replace('{{subst:Unc}} <!-- Remove this line once you have '
+ 'added categories -->', '')
CH += u'[[Category:' + self.category + u']]'
bot = upload.UploadRobot(url=self.imagePage.fileUrl(), description=CH,
useFilename=self.newname, keepFilename=True,
verifyDescription=False, ignoreWarning=True,
- targetSite=pywikibot.Site('commons', 'commons'))
+ targetSite=pywikibot.Site('commons',
+ 'commons'))
bot.run()
# Should check if the image actually was uploaded
@@ -301,20 +305,23 @@
# Remove the move to commons templates
if self.imagePage.site.language() in moveToCommonsTemplate:
- for moveTemplate in moveToCommonsTemplate[self.imagePage.site.language()]:
+ for moveTemplate in moveToCommonsTemplate[
+ self.imagePage.site.language()]:
imtxt = re.sub(u'(?i)\{\{' + moveTemplate + u'[^\}]*\}\}',
u'', imtxt)
# add {{NowCommons}}
if self.imagePage.site.language() in nowCommonsTemplate:
- addTemplate = nowCommonsTemplate[self.imagePage.site.language()] % self.newname
+ addTemplate = nowCommonsTemplate[
+ self.imagePage.site.language()] % self.newname
else:
addTemplate = nowCommonsTemplate['_default'] % self.newname
- commentText = i18n.twtranslate(self.imagePage.site,
- 'commons-file-now-available',
- {'localfile': self.imagePage.title(withNamespace=False),
- 'commonsfile': self.newname})
+ commentText = i18n.twtranslate(
+ self.imagePage.site,
+ 'commons-file-now-available',
+ {'localfile': self.imagePage.title(withNamespace=False),
+ 'commonsfile': self.newname})
pywikibot.showDiff(self.imagePage.get(), imtxt + addTemplate)
self.imagePage.put(imtxt + addTemplate, comment=commentText)
@@ -322,27 +329,31 @@
self.gen = pagegenerators.FileLinksGenerator(self.imagePage)
self.preloadingGen = pagegenerators.PreloadingGenerator(self.gen)
- # If the image is uploaded under a different name, replace all instances
+ # If the image is uploaded under a different name, replace all
+ # instances
if self.imagePage.title(withNamespace=False) != self.newname:
- moveSummary = i18n.twtranslate(self.imagePage.site,
- 'commons-file-moved',
- {'localfile': self.imagePage.title(withNamespace=False),
- 'commonsfile': self.newname})
+ moveSummary = i18n.twtranslate(
+ self.imagePage.site,
+ 'commons-file-moved',
+ {'localfile': self.imagePage.title(withNamespace=False),
+ 'commonsfile': self.newname})
- imagebot = image.ImageRobot(generator=self.preloadingGen,
- oldImage=self.imagePage.title(withNamespace=False),
- newImage=self.newname,
- summary=moveSummary, always=True,
- loose=True)
+ imagebot = image.ImageRobot(
+ generator=self.preloadingGen,
+ oldImage=self.imagePage.title(withNamespace=False),
+ newImage=self.newname,
+ summary=moveSummary, always=True, loose=True)
imagebot.run()
return
def fixAuthor(self, pageText):
"""Fix the author field in the information template."""
informationRegex = re.compile(
- u'\|Author\=Original uploader was (?P<author>\[\[:\w+:\w+:\w+\|\w+\]\] at \[.+\])')
+ '\|Author\=Original uploader was '
+ '(?P<author>\[\[:\w+:\w+:\w+\|\w+\]\] at \[.+\])')
selfRegex = re.compile(
- u'\{\{self\|author\=(?P<author>\[\[:\w+:\w+:\w+\|\w+\]\] at \[.+\])\|')
+ '\{\{self\|author\='
+ '(?P<author>\[\[:\w+:\w+:\w+\|\w+\]\] at \[.+\])\|')
# Find the |Author=Original uploader was ....
informationMatch = informationRegex.search(pageText)
@@ -400,7 +411,8 @@
imageinfo = Tkinter.Label(self.root, text='Uploaded by %s.' % uploader)
textarea = Tkinter.Text(self.root)
textarea.insert(Tkinter.END, content.encode('utf-8'))
- textarea.config(state=Tkinter.DISABLED, height=8, width=40, padx=0, pady=0,
+ textarea.config(state=Tkinter.DISABLED,
+ height=8, width=40, padx=0, pady=0,
wrap=Tkinter.WORD, yscrollcommand=scrollbar.set)
scrollbar.config(command=textarea.yview)
self.entry = Tkinter.Entry(self.root)
@@ -413,7 +425,8 @@
command=self.add2_auto_skip)
browser_button = Tkinter.Button(self.root, text='View in browser',
command=self.open_in_browser)
- skip_button = Tkinter.Button(self.root, text="Skip", command=self.skip_file)
+ skip_button = Tkinter.Button(self.root, text='Skip',
+ command=self.skip_file)
ok_button = Tkinter.Button(self.root, text="OK", command=self.ok_file)
# Start grid
@@ -437,7 +450,12 @@
self.root.destroy()
def getnewname(self):
- """Activate the dialog and return the new name and if the image is skipped."""
+ """
+ Activate dialog.
+
+ @return: new name and if the image is skipped
+ @rtype: tuple
+ """
self.root.mainloop()
return (self.changename, self.skip)
@@ -546,13 +564,17 @@
if not CommonsPage.exists():
break
else:
- pywikibot.output('Image already exists, pick another name or skip this image')
- # We dont overwrite images, pick another name, go to the start of the loop
+ pywikibot.output(
+ 'Image already exists, pick another name or '
+ 'skip this image')
+ # We dont overwrite images, pick another name, go to
+ # the start of the loop
if not skip:
imageTransfer(imagepage, newname, category).start()
- pywikibot.output(u'Still ' + str(threading.activeCount()) + u' active threads, lets wait')
+ pywikibot.output('Still ' + str(threading.activeCount()) +
+ ' active threads, lets wait')
for openthread in threading.enumerate():
if openthread != threading.currentThread():
openthread.join()
diff --git a/scripts/imagecopy_self.py b/scripts/imagecopy_self.py
index d4a0a1b..ff5a386 100644
--- a/scripts/imagecopy_self.py
+++ b/scripts/imagecopy_self.py
@@ -162,54 +162,72 @@
licenseTemplates = {
- 'de': [(u'\{\{Bild-CC-by-sa/3\.0/de\}\}[\s\r\n]*\{\{Bild-CC-by-sa/3\.0\}\}[\s\r\n]*\{\{Bild-GFDL-Neu\}\}',
- u'{{Self|Cc-by-sa-3.0-de|Cc-by-sa-3.0|GFDL|author=[[:%(lang)s:User:%(author)s|%(author)s]] at [http://%(lang)s.%' +
- u'(family)s.org %(lang)s.%(family)s]}}'),
- (u'\{\{Bild-GFDL\}\}[\s\r\n]*\{\{Bild-CC-by-sa/(\d\.\d)\}\}',
- u'{{Self|GFDL|Cc-by-sa-3.0-migrated|Cc-by-sa-\\1|author=[[:%(lang)s:User:%(author)s|%(author)s]] at [http://%(lang' +
- u')s.%(family)s.org %(lang)s.%(family)s]}}'),
- (u'\{\{Bild-GFDL\}\}',
- u'{{Self|GFDL|Cc-by-sa-3.0-migrated|author=[[:%(lang)s:User:%(author)s|%(author)s]] at [http://%(lang)s.%(family)s' +
- u'.org %(lang)s.%(family)s]}}'),
- (u'\{\{Bild-CC-by-sa/(\d\.\d)\}\}',
- u'{{Self|Cc-by-sa-\\1|author=[[:%(lang)s:User:%(author)s|%(author)s]] at [http://%(lang)s.%(family)s.org %(lang)s.' +
- u'%(family)s]}}'),
- (u'\{\{Bild-CC-by-sa/(\d\.\d)/de\}\}',
- u'{{Self|Cc-by-sa-\\1-de|author=[[:%(lang)s:User:%(author)s|%(author)s]] at [http://%(lang)s.%(family)s.org' +
- u' %(lang)s.%(family)s]}}'),
- (u'\{\{Bild-CC-by/(\d\.\d)\}\}',
- u'{{Self|Cc-by-\\1|author=[[:%(lang)s:User:%(author)s|%(author)s]] at [http://%(lang)s.%(family)s.org' +
- u' %(lang)s.%(family)s]}}'),
- (u'\{\{Bild-CC-by/(\d\.\d)/de\}\}',
- u'{{Self|Cc-by-\\1-de|author=[[:%(lang)s:User:%(author)s|%(author)s]] at [http://%(lang)s.%(family)s.org' +
- u' %(lang)s.%(family)s]}}'),
- ],
- 'en': [(u'\{\{(self|self2)\|([^\}]+)\}\}',
- u'{{Self|\\2|author=[[:%(lang)s:User:%(author)s|%(author)s]] at [http://%(lang)s.%(family)s.org' +
- u' %(lang)s.%(family)s]}}'),
- (u'\{\{(GFDL-self|GFDL-self-no-disclaimers)\|([^\}]+)\}\}',
- u'{{Self|GFDL|\\2|author=[[:%(lang)s:User:%(author)s|%(author)s]] at [http://%(lang)s.%(family)s.org' +
- u'%(lang)s.%(family)s]}}'),
- (u'\{\{GFDL-self-with-disclaimers\|([^\}]+)\}\}',
- u'{{Self|GFDL-with-disclaimers|\\1|author=[[:%(lang)s:User:%(author)s|%(author)s]] at' +
- u'[http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
- (u'\{\{PD-self(\|date=[^\}]+)?\}\}',
- u'{{PD-user-w|%(lang)s|%(family)s|%(author)s}}'),
- (u'\{\{Multilicense replacing placeholder(\|[^\}\|=]+=[^\}\|]+)*(?P<migration>\|[^\}\|=]+=[^\}\|]+)' +
- u'(\|[^\}\|=]+=[^\}\|]+)*\}\}',
- u'{{Self|GFDL|Cc-by-sa-2.5,2.0,1.0\\g<migration>|author=[[:%(lang)s:User:%(author)s|%(author)s]]' +
- u' at [http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
- (u'\{\{Multilicense replacing placeholder new(\|class=[^\}]+)?\}\}',
- u'{{Self|GFDL|Cc-by-sa-3.0,2.5,2.0,1.0|author=[[:%(lang)s:User:%(author)s|%(author)s]] at' +
- u'[http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
- ],
- 'lb': [(u'\{\{(self|self2)\|([^\}]+)\}\}', u'{{Self|\\2|author=[[:%(lang)s:User:%(author)s|%(author)s]]' +
- u' at [http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
- ],
- 'nds-nl': [(u'\{\{PD-eigenwark\}\}', u'{{PD-user-w|%(lang)s|%(family)s|%(author)s}}'),
- ],
- 'shared': [(u'\{\{(self|self2)\|([^\}]+)\}\}', u'{{Self|\\2|author=%(author)s at old wikivoyage shared}}'),
- ],
+ 'de': [
+ ('\{\{Bild-CC-by-sa/3\.0/de\}\}[\s\r\n]*\{\{Bild-CC-by-sa/3\.0\}\}'
+ '[\s\r\n]*\{\{Bild-GFDL-Neu\}\}',
+ '{{Self|Cc-by-sa-3.0-de|Cc-by-sa-3.0|GFDL|author='
+ '[[:%(lang)s:User:%(author)s|%(author)s]] at [http://%(lang)s.%'
+ '(family)s.org %(lang)s.%(family)s]}}'),
+ ('\{\{Bild-GFDL\}\}[\s\r\n]*\{\{Bild-CC-by-sa/(\d\.\d)\}\}',
+ '{{Self|GFDL|Cc-by-sa-3.0-migrated|Cc-by-sa-\\1|author='
+ '[[:%(lang)s:User:%(author)s|%(author)s]] at '
+ '[http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
+ ('\{\{Bild-GFDL\}\}',
+ '{{Self|GFDL|Cc-by-sa-3.0-migrated|author='
+ '[[:%(lang)s:User:%(author)s|%(author)s]] at '
+ '[http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
+ ('\{\{Bild-CC-by-sa/(\d\.\d)\}\}',
+ '{{Self|Cc-by-sa-\\1|author=[[:%(lang)s:User:%(author)s|%(author)s]] '
+ 'at [http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
+ ('\{\{Bild-CC-by-sa/(\d\.\d)/de\}\}',
+ '{{Self|Cc-by-sa-\\1-de|author='
+ '[[:%(lang)s:User:%(author)s|%(author)s]] at '
+ '[http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
+ ('\{\{Bild-CC-by/(\d\.\d)\}\}',
+ '{{Self|Cc-by-\\1|author=[[:%(lang)s:User:%(author)s|%(author)s]] at '
+ '[http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
+ ('\{\{Bild-CC-by/(\d\.\d)/de\}\}',
+ '{{Self|Cc-by-\\1-de|author=[[:%(lang)s:User:%(author)s|%(author)s]] '
+ 'at [http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
+ ],
+ 'en': [
+ ('\{\{(self|self2)\|([^\}]+)\}\}',
+ '{{Self|\\2|author=[[:%(lang)s:User:%(author)s|%(author)s]] at '
+ '[http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
+ ('\{\{(GFDL-self|GFDL-self-no-disclaimers)\|([^\}]+)\}\}',
+ '{{Self|GFDL|\\2|author=[[:%(lang)s:User:%(author)s|%(author)s]] at '
+ '[http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
+ ('\{\{GFDL-self-with-disclaimers\|([^\}]+)\}\}',
+ '{{Self|GFDL-with-disclaimers|\\1|author='
+ '[[:%(lang)s:User:%(author)s|%(author)s]] at '
+ '[http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
+ ('\{\{PD-self(\|date=[^\}]+)?\}\}',
+ '{{PD-user-w|%(lang)s|%(family)s|%(author)s}}'),
+ ('\{\{Multilicense replacing placeholder'
+ '(\|[^\}\|=]+=[^\}\|]+)*(?P<migration>\|[^\}\|=]+=[^\}\|]+)'
+ '(\|[^\}\|=]+=[^\}\|]+)*\}\}',
+ '{{Self|GFDL|Cc-by-sa-2.5,2.0,1.0\\g<migration>|author='
+ '[[:%(lang)s:User:%(author)s|%(author)s]] at '
+ '[http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
+ ('\{\{Multilicense replacing placeholder new(\|class=[^\}]+)?\}\}',
+ '{{Self|GFDL|Cc-by-sa-3.0,2.5,2.0,1.0|author='
+ '[[:%(lang)s:User:%(author)s|%(author)s]] at'
+ '[http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
+ ],
+ 'lb': [
+ ('\{\{(self|self2)\|([^\}]+)\}\}',
+ '{{Self|\\2|author='
+ '[[:%(lang)s:User:%(author)s|%(author)s]] at '
+ '[http://%(lang)s.%(family)s.org %(lang)s.%(family)s]}}'),
+ ],
+ 'nds-nl': [
+ ('\{\{PD-eigenwark\}\}',
+ '{{PD-user-w|%(lang)s|%(family)s|%(author)s}}'),
+ ],
+ 'shared': [
+ ('\{\{(self|self2)\|([^\}]+)\}\}',
+ '{{Self|\\2|author=%(author)s at old wikivoyage shared}}'),
+ ],
}
sourceGarbage = {
@@ -388,9 +406,11 @@
u'skip': False}
def getNewFieldsFromInformation(self, imagepage):
- """Try to extract fields from current information template for the new information template."""
- # fields = [u'location', u'description', u'source', u'date', u'author', u'permission', u'other versions']
- # FIXME: The implementation for German has to be checked for the "strange" fields
+ """Extract fields from current information template for new template."""
+ # fields = ['location', 'description', 'source', 'date', 'author',
+ # 'permission', 'other versions']
+ # FIXME: The implementation for German has to be checked for the
+ # "strange" fields
description = u''
source = u''
@@ -414,11 +434,14 @@
# To lowercase, remove underscores and strip of spaces
field = field.lower().replace(u'_', u' ').strip()
# See if first part is in fields list
- if field in informationFields.get(imagepage.site.language()).keys():
+ if field in informationFields.get(
+ imagepage.site.language()).keys():
# Ok, field is good, store it.
- contents[informationFields.get(imagepage.site.language()).get(field)] = value.strip()
+ contents[informationFields.get(
+ imagepage.site.language()).get(field)] = value.strip()
- # We now got the contents from the old information template. Let's get the info for the new one
+ # We now got the contents from the old information template.
+ # Let's get the info for the new one
# Description
# FIXME: Add {{<lang>|<original text>}} if <lang is valid at Commons
@@ -470,11 +493,11 @@
return (description, date, source, author, permission, other_versions)
def getNewFieldsFromFreetext(self, imagepage):
- """Try to extract fields from free text for the new information template."""
+ """Extract fields from free text for the new information template."""
text = imagepage.get()
# text = re.sub(u'== Summary ==', u'', text, re.IGNORECASE)
# text = re.sub(u'== Licensing ==', u'', text, re.IGNORECASE)
- # text = re.sub(u'\{\{(self|self2)\|[^\}]+\}\}', u'', text, re.IGNORECASE)
+ # text = re.sub('\{\{(self|self2)\|[^\}]+\}\}', '', text, re.IGNORECASE)
for toRemove in sourceGarbage[imagepage.site.language()]:
text = re.sub(toRemove, u'', text, flags=re.IGNORECASE)
@@ -499,28 +522,31 @@
"""
uploadtime = imagepage.getFileVersionHistory()[-1][0]
uploadDatetime = datetime.strptime(uploadtime, u'%Y-%m-%dT%H:%M:%SZ')
- return (u'{{Date|' + str(uploadDatetime.year) + u'|' + str(uploadDatetime.month) + u'|' + str(uploadDatetime.day) +
+ return (u'{{Date|' + str(uploadDatetime.year) + u'|' +
+ str(uploadDatetime.month) + u'|' + str(uploadDatetime.day) +
u'}} (original upload date)')
def getSource(self, imagepage, source=u''):
- """Get the text to put in the source field of the new information template."""
+ """Get text to put in the source field of new information template."""
site = imagepage.site()
lang = site.code
family = site.family.name
if source == u'':
source = u'{{Own}}'
- return source.strip() + u'<BR />Transferred from [http://%(lang)s.%(family)s.org %(lang)s.%(family)s]' \
- % {u'lang': lang, u'family': family}
+ return (source.strip() +
+ '<BR />Transferred from [http://%(lang)s.%(family)s.org '
+ '%(lang)s.%(family)s]') % {u'lang': lang, u'family': family}
def getAuthorText(self, imagepage):
- """Get the original uploader to put in the author field of the new information template."""
+ """Get uploader to put in the author field of information template."""
site = imagepage.site()
lang = site.code
family = site.family.name
firstuploader = self.getAuthor(imagepage)
- return (u'[[:%(lang)s:User:%(firstuploader)s|%(firstuploader)s]] at [http://%(lang)s.%(family)s.org %(lang)s.%(family)s]'
+ return ('[[:%(lang)s:User:%(firstuploader)s|%(firstuploader)s]] at '
+ '[http://%(lang)s.%(family)s.org %(lang)s.%(family)s]'
% {u'lang': lang, u'family': family,
u'firstuploader': firstuploader})
@@ -629,7 +655,8 @@
else:
pywikibot.output('Image already exists, pick another name '
'or skip this image')
- # We dont overwrite images, pick another name, go to the start of the loop
+ # We dont overwrite images, pick another name, go to the
+ # start of the loop
# Put the fields in the queue to be uploaded
self.uploadQueue.put(fields)
@@ -639,7 +666,13 @@
"""The dialog window for image info."""
- def __init__(self, fields): # imagepage, description, date, source, author, licensetemplate, categories):
+ def __init__(self, fields):
+ """Constructor.
+
+ fields:
+ imagepage, description, date, source, author, licensetemplate,
+ categories
+ """
self.root = Tkinter.Tk()
# "%dx%d%+d%+d" % (width, height, xoffset, yoffset)
# Always appear the same size and in the bottom-left corner
@@ -670,27 +703,34 @@
self.scrollbar = Tkinter.Scrollbar(self.root, orient=Tkinter.VERTICAL)
self.old_description = Tkinter.Text(self.root)
- self.old_description.insert(Tkinter.END, self.imagepage.get().encode('utf-8'))
- self.old_description.config(state=Tkinter.DISABLED, height=8, width=140, padx=0, pady=0, wrap=Tkinter.WORD,
+ self.old_description.insert(Tkinter.END,
+ self.imagepage.get().encode('utf-8'))
+ self.old_description.config(state=Tkinter.DISABLED,
+ height=8, width=140, padx=0, pady=0,
+ wrap=Tkinter.WORD,
yscrollcommand=self.scrollbar.set)
self.scrollbar.config(command=self.old_description.yview)
- self.old_description_label = Tkinter.Label(self.root,
- text=u'The old description was : ')
+ self.old_description_label = Tkinter.Label(
+ self.root, text='The old description was : ')
self.new_description_label = Tkinter.Label(self.root,
- text=u'The new fields are : ')
+ text='The new fields are : ')
self.filename_label = Tkinter.Label(self.root, text=u'Filename : ')
- self.information_description_label = Tkinter.Label(self.root,
- text=u'Description : ')
+ self.information_description_label = Tkinter.Label(
+ self.root, text='Description : ')
self.information_date_label = Tkinter.Label(self.root, text=u'Date : ')
- self.information_source_label = Tkinter.Label(self.root, text=u'Source : ')
- self.information_author_label = Tkinter.Label(self.root, text=u'Author : ')
- self.information_permission_label = Tkinter.Label(self.root, text=u'Permission : ')
- self.information_other_versions_label = Tkinter.Label(self.root, text=u'Other versions : ')
+ self.information_source_label = Tkinter.Label(self.root,
+ text='Source : ')
+ self.information_author_label = Tkinter.Label(self.root,
+ text='Author : ')
+ self.information_permission_label = Tkinter.Label(self.root,
+ text='Permission : ')
+ self.information_other_versions_label = Tkinter.Label(
+ self.root, text='Other versions : ')
- self.information_licensetemplate_label = Tkinter.Label(self.root,
- text=u'License : ')
+ self.information_licensetemplate_label = Tkinter.Label(
+ self.root, text='License : ')
self.information_categories_label = Tkinter.Label(self.root,
text=u'Categories : ')
@@ -726,10 +766,13 @@
self.information_licensetemplate.insert(0, self.licensetemplate)
self.information_categories.insert(0, self.categories)
- self.browser_button = Tkinter.Button(self.root, text='View in browser',
+ self.browser_button = Tkinter.Button(self.root,
+ text='View in browser',
command=self.open_in_browser)
- self.skip_button = Tkinter.Button(self.root, text="Skip", command=self.skipFile)
- self.ok_button = Tkinter.Button(self.root, text="OK", command=self.ok_file)
+ self.skip_button = Tkinter.Button(self.root, text='Skip',
+ command=self.skipFile)
+ self.ok_button = Tkinter.Button(self.root, text='OK',
+ command=self.ok_file)
# Start grid
self.old_description_label.grid(row=0, column=0, columnspan=3)
@@ -780,7 +823,7 @@
self.root.destroy()
def getnewmetadata(self):
- """Activate the dialog and return the new name and if the image is skipped."""
+ """Activate dialog and return new name and if the image is skipped."""
self.root.mainloop()
return {u'imagepage': self.imagepage,
@@ -828,10 +871,12 @@
cid = self.buildNewImageDescription(fields)
pywikibot.output(cid)
bot = upload.UploadRobot(url=fields.get('imagepage').fileUrl(),
- description=cid, useFilename=fields.get('filename'),
+ description=cid,
+ useFilename=fields.get('filename'),
keepFilename=True, verifyDescription=False,
ignoreWarning=True,
- targetSite=pywikibot.Site('commons', 'commons'))
+ targetSite=pywikibot.Site('commons',
+ 'commons'))
bot.run()
self.tagNowcommons(fields.get('imagepage'), fields.get('filename'))
@@ -872,7 +917,7 @@
return cid
def getOriginalUploadLog(self, imagepage):
- """Get the original upload log to put at the bottom of the image description page at Commons."""
+ """Get upload log to put at the bottom of the image description page."""
filehistory = imagepage.getFileVersionHistory()
filehistory.reverse()
@@ -884,22 +929,25 @@
imagepage.title()).replace(u'&redirect=no&useskin=monobook', u'')
result = u'== {{Original upload log}} ==\n'
- result += (u'The original description page is/was [http://%(lang)s.%(family)s.org%(sourceimage)s here]. All following' +
- u'user names refer to %(lang)s.%(family)s.\n'
+ result += ('The original description page is/was '
+ '[http://%(lang)s.%(family)s.org%(sourceimage)s here]. '
+ 'All following user names refer to %(lang)s.%(family)s.\n'
% {u'lang': lang, u'family': family,
u'sourceimage': sourceimage})
for (timestamp, username, resolution, size, comment) in filehistory:
date = datetime.strptime(
timestamp, u'%Y-%m-%dT%H:%M:%SZ').strftime('%Y-%m-%d %H:%M')
- result += (u'* %(date)s [[:%(lang)s:user:%(username)s|%(username)s]] %(resolution)s' +
- u' (%(size)s bytes) \'\'<nowiki>%(comment)s</nowiki>\'\'\n' % {
- u'lang': lang,
- u'family': family,
- u'date': date,
- u'username': username,
- u'resolution': resolution,
- u'size': size,
- u'comment': comment})
+ result += (
+ '* %(date)s [[:%(lang)s:user:%(username)s|%(username)s]] '
+ "%(resolution)s (%(size)s bytes) ''"
+ "<nowiki>%(comment)s</nowiki>''\n" % {
+ 'lang': lang,
+ 'family': family,
+ 'date': date,
+ 'username': username,
+ 'resolution': resolution,
+ 'size': size,
+ 'comment': comment})
return result
@@ -913,7 +961,8 @@
# Remove the move to commons templates
if imagepage.site.language() in moveToCommonsTemplate:
- for moveTemplate in moveToCommonsTemplate[imagepage.site.language()]:
+ for moveTemplate in moveToCommonsTemplate[
+ imagepage.site.language()]:
imtxt = re.sub(u'(?i)\{\{' + moveTemplate +
u'[^\}]*\}\}', u'', imtxt)
@@ -933,7 +982,7 @@
imagepage.put(imtxt + addTemplate, comment=commentText)
def replaceUsage(self, imagepage, filename):
- """If the image is uploaded under a different name, replace all usage."""
+ """replace all usage if image is uploaded under a different name."""
if imagepage.title(withNamespace=False) != filename:
gen = pagegenerators.FileLinksGenerator(imagepage)
preloadingGen = pagegenerators.PreloadingGenerator(gen)
@@ -943,10 +992,11 @@
{'localfile': imagepage.title(withNamespace=False),
'commonsfile': filename})
- imagebot = image.ImageRobot(generator=preloadingGen,
- oldImage=imagepage.title(withNamespace=False),
- newImage=filename, summary=moveSummary,
- always=True, loose=True)
+ imagebot = image.ImageRobot(
+ generator=preloadingGen,
+ oldImage=imagepage.title(withNamespace=False),
+ newImage=filename, summary=moveSummary,
+ always=True, loose=True)
imagebot.run()
diff --git a/scripts/panoramiopicker.py b/scripts/panoramiopicker.py
index 5506abd..3d738cb 100644
--- a/scripts/panoramiopicker.py
+++ b/scripts/panoramiopicker.py
@@ -176,7 +176,9 @@
if photoInfo.get(u'license') == u'by-sa':
desc += u'{{Cc-by-sa-3.0}}\n'
if panoramioreview:
- desc += u'{{Panoramioreview|%s|{{subst:CURRENTYEAR}}-{{subst:CURRENTMONTH}}-{{subst:CURRENTDAY2}}}}\n' % (reviewer,)
+ desc += ('{{Panoramioreview|%s|{{subst:CURRENTYEAR}}-'
+ '{{subst:CURRENTMONTH}}-{{subst:CURRENTDAY2}}}}\n'
+ % reviewer)
else:
desc += u'{{Panoramioreview}}\n'
@@ -254,7 +256,8 @@
"""Loop over a set of Panoramio photos."""
i = 0
has_more = True
- url = u'http://www.panoramio.com/map/get_panoramas.php?set=%s&from=%s&to=%s&size=or…'
+ url = ('http://www.panoramio.com/map/get_panoramas.php?'
+ 'set=%s&from=%s&to=%s&size=original')
while has_more:
gotInfo = False
maxtries = 10
diff --git a/tests/namespace_tests.py b/tests/namespace_tests.py
index 2ed8bf9..922ec3b 100644
--- a/tests/namespace_tests.py
+++ b/tests/namespace_tests.py
@@ -211,14 +211,16 @@
a.defaultcontentmodel = 'bar'
s = repr(a)
- r = "Namespace(id=0, custom_name=%r, canonical_name=%r, aliases=[], defaultcontentmodel=%r)" \
- % (unicode('Foo'), unicode('Foo'), unicode('bar'))
+ r = ('Namespace(id=0, custom_name=%r, canonical_name=%r, aliases=[], '
+ 'defaultcontentmodel=%r)' %
+ (unicode('Foo'), unicode('Foo'), unicode('bar')))
self.assertEqual(s, r)
a.case = 'upper'
s = repr(a)
- r = "Namespace(id=0, custom_name=%r, canonical_name=%r, aliases=[], case=%r, defaultcontentmodel=%r)" \
- % (unicode('Foo'), unicode('Foo'), unicode('upper'), unicode('bar'))
+ r = ('Namespace(id=0, custom_name=%r, canonical_name=%r, aliases=[], '
+ 'case=%r, defaultcontentmodel=%r)' %
+ (unicode('Foo'), unicode('Foo'), unicode('upper'), unicode('bar')))
self.assertEqual(s, r)
b = eval(repr(a))
diff --git a/tox.ini b/tox.ini
index 5437e66..0708150 100644
--- a/tox.ini
+++ b/tox.ini
@@ -112,7 +112,7 @@
# P102,P103: string does contain unindexed parameters; see I36355923
ignore = E402,D105,D211,FI10,FI12,FI13,FI15,FI5,H101,H201,H236,H301,H404,H405,I100,I101
exclude = .tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/*
-max_line_length = 130
+max_line_length = 100
accept-encodings = utf-8
require-code = true
putty-ignore =
@@ -141,7 +141,7 @@
# see explanations above
ignore = E402
exclude = .tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/*
-max_line_length = 130
+max_line_length = 100
[pep257]
# see explanations above
--
To view, visit https://gerrit.wikimedia.org/r/186957
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia45d36ea51fd0e69f0a7407fbea83b4e13b56e44
Gerrit-PatchSet: 23
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [fix] test_detect_failure is no longer valid,
......................................................................
[fix] test_detect_failure is no longer valid,
marked ist with @unittest.expectedFailure until we find another wiki.
Change-Id: Ib9eb16b0222e0182c234e7b1e7b0e28b84f17bc5
---
M tests/site_detect_tests.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_detect_tests.py b/tests/site_detect_tests.py
index 6a8ea4a..beef3b5 100644
--- a/tests/site_detect_tests.py
+++ b/tests/site_detect_tests.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Test for site detection."""
#
-# (C) Pywikibot team, 2014-2015
+# (C) Pywikibot team, 2014-2016
#
# Distributed under the terms of the MIT license.
#
@@ -210,6 +210,7 @@
self.assertSite('http://tfwiki.net/wiki/$1')
self.assertAllPass()
+ @unittest.expectedFailure # Test no longer valid
def test_detect_failure(self):
"""Test detection failure for MediaWiki sites with an API."""
# SSL certificate verification fails
--
To view, visit https://gerrit.wikimedia.org/r/269929
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib9eb16b0222e0182c234e7b1e7b0e28b84f17bc5
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: casechecker.py: replace xuniqueCombinations with library functions
......................................................................
casechecker.py: replace xuniqueCombinations with library functions
Replace xuniqueCombinations() with itertools.combinations().
Change-Id: Ifb31aa0963e1edb1d6fc735882d5d9fe43b5b6c3
---
M scripts/casechecker.py
1 file changed, 3 insertions(+), 18 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/casechecker.py b/scripts/casechecker.py
index 06ee014..30f4c8c 100755
--- a/scripts/casechecker.py
+++ b/scripts/casechecker.py
@@ -10,6 +10,7 @@
__version__ = '$Id$'
import codecs
+import itertools
import os
import re
from string import ascii_letters
@@ -27,22 +28,6 @@
if sys.version_info[0] > 2:
xrange = range
-
-#
-# Permutations code was taken from
-# https://code.activestate.com/recipes/190465/
-#
-def xuniqueCombinations(items, n):
- if n == 0:
- yield []
- else:
- for i in xrange(len(items)):
- for cc in xuniqueCombinations(items[i + 1:], n - 1):
- yield [items[i]] + cc
-# End of permutation code
-#
-
-#
# Windows Concole colors
# This code makes this script Windows ONLY!!!
# Feel free to adapt it to another platform
@@ -609,8 +594,8 @@
# latin character.
for itemCntToPick in xrange(0, len(ambigBadWords) + 1):
title2 = title
- for uc in xuniqueCombinations(list(ambigBadWords),
- itemCntToPick):
+ for uc in itertools.combinations(list(ambigBadWords),
+ itemCntToPick):
wordsToLat = ambigBadWords.copy()
for bw in uc:
title2 = title2.replace(bw, mapLcl[bw])
--
To view, visit https://gerrit.wikimedia.org/r/272003
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifb31aa0963e1edb1d6fc735882d5d9fe43b5b6c3
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
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 <>
jenkins-bot has submitted this change and it was merged.
Change subject: [bugfix] Deprecate -quick option
......................................................................
[bugfix] Deprecate -quick option
Also remove known issue which is related to old screen scraping code
Bug: T75019
Change-Id: Id1572614294640f25fd6db5ed15fa7ae50245fe2
---
M scripts/welcome.py
1 file changed, 10 insertions(+), 28 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/welcome.py b/scripts/welcome.py
index 7ebcfa6..b531656 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -89,8 +89,6 @@
-quiet Prevents users without contributions are displayed
- -quick Provide quick check by API bulk-retrieve user datas
-
********************************* GUIDE ***********************************
Report, Bad and white list guide:
@@ -147,12 +145,6 @@
NOTE: The white space and <pre></pre> aren't required but I suggest you to
use them.
-*************************** Known issues/FIXMEs ****************************
-* *
-* The regex to load the user might be slightly different from project to *
-* project. (In this case, write to Filnik or the PWRF for help...) *
-* Use a class to group together the functions used. *
-* *
******************************** Badwords **********************************
The list of Badwords of the code is opened. If you think that a word is
@@ -173,8 +165,8 @@
# (C) Filnik, 2007-2011
# (C) Daniel Herding, 2007
# (C) Alex Shih-Han Lin, 2009-2010
-# (C) xqt, 2009-2015
-# (C) Pywikibot team, 2008-2015
+# (C) xqt, 2009-2016
+# (C) Pywikibot team, 2008-2016
#
# Distributed under the terms of the MIT license.
#
@@ -193,9 +185,9 @@
import pywikibot
-from pywikibot import config
-from pywikibot import i18n
+from pywikibot import config, i18n
from pywikibot.tools.formatter import color_format
+from pywikibot.tools import issue_deprecation_warning
if sys.version_info[0] > 2:
unicode = str
@@ -206,16 +198,11 @@
# page/user/summary/etc so the need to specify language and project have
# been eliminated.
# FIXME: Not all language/project combinations have been defined yet.
-# Add the following strings to customise for a language:
-# logbook, talk_page, netext, user, con, report_page
-# bad_pag, report_text, logt, random_sign and whitelist_pg.
+# Add the following strings to customise for a language:
+# logbook, talk_page, netext, user, con, report_page
+# bad_pag, report_text, logt, random_sign and whitelist_pg.
############################################################################
-############################################################################
-############################################################################
-
-# The text below are dictionaries. Copy the 'en' line, change 'en' in your
-# language (e.g. 'de') and modify/translate the text.
# The page where the bot will save the log (e.g. Wikipedia:Welcome log).
#
@@ -442,7 +429,6 @@
defaultSign = '--~~~~' # default signature
queryLimit = 50 # number of users that the bot load to check
quiet = False # Prevents users without contributions are displayed
- quick = False # Provide quick check by API bulk-retrieve user datas
class WelcomeBot(object):
@@ -732,12 +718,8 @@
def run(self):
while True:
welcomed_count = 0
- if globalvar.quick and self.site.has_api():
- us = [x for x in self.parseNewUserLog()]
- showStatus()
- pywikibot.User.getall(self.site, us)
- else:
- us = (pywikibot.User(self.site, users.user()) for users in self.parseNewUserLog())
+ us = (pywikibot.User(self.site, users.user())
+ for users in self.parseNewUserLog())
for users in us:
if users.isBlocked():
showStatus(3)
@@ -982,7 +964,7 @@
elif arg == '-quiet':
globalvar.quiet = True
elif arg == '-quick':
- globalvar.quick = True
+ issue_deprecation_warning('The usage of "-quick" option', None, 2)
# Filename and Pywikibot path
# file where is stored the random signature index
--
To view, visit https://gerrit.wikimedia.org/r/269945
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id1572614294640f25fd6db5ed15fa7ae50245fe2
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>