jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, but someone else must approve Dvorapa: Looks good to me, approved jenkins-bot: Verified
[PEP8] Fix W504 errors in 3 files

Fixed W504 errors in order to have a consistent code style.
This has the consequence of introducing W503 instead.
W504: unary operator at end of line.
W503: unary operator at beginning of line.

Bug: T207836
Change-Id: I2d1924f71b0a669b650fbf17c053f28c1e5ef0ee
---
M scripts/checkimages.py
M scripts/isbn.py
M scripts/match_images.py
3 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index f27350b..46aa3bb 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -749,8 +749,8 @@
self.notification)

# Check maximum number of notifications for this talk page
- if (self.num_notify is not None and
- self.num_notify[self.talk_page.title()] == 0):
+ if (self.num_notify is not None
+ and self.num_notify[self.talk_page.title()] == 0):
pywikibot.output('Maximum notifications reached, skip.')
return

@@ -872,13 +872,13 @@
# It's not only on commons but the image needs a check
# the second usually is a url or something like that.
# Compare the two in equal way, both url.
- repme = ((self.list_entry +
- "is also on '''Commons''': [[commons:File:%s]]")
+ repme = ((self.list_entry
+ + "is also on '''Commons''': [[commons:File:%s]]")
% (self.imageName,
commons_image_with_this_hash.title(
with_ns=False)))
- if (self.image.title(as_url=True) ==
- commons_image_with_this_hash.title(as_url=True)):
+ if (self.image.title(as_url=True)
+ == commons_image_with_this_hash.title(as_url=True)):
repme += ' (same name)'
self.report_image(self.imageName, self.rep_page, self.com, repme,
addings=False)
@@ -915,8 +915,8 @@

for dup_page in duplicates:
if (dup_page.title(as_url=True) != self.image.title(
- as_url=True) or
- self.timestamp is None):
+ as_url=True)
+ or self.timestamp is None):
try:
self.timestamp = (
dup_page.latest_file_info.timestamp)
@@ -941,8 +941,8 @@
except pywikibot.NoPage:
continue

- if not (re.findall(dupRegex, DupPageText) or
- re.findall(dupRegex, older_page_text)):
+ if not (re.findall(dupRegex, DupPageText)
+ or re.findall(dupRegex, older_page_text)):
pywikibot.output(
'{} is a duplicate and has to be tagged...'
.format(dup_page))
@@ -1024,10 +1024,8 @@
% self.image.title(as_url=True))

for dup_page in duplicates:
- if (
- dup_page.title(as_url=True) ==
- self.image.title(as_url=True)
- ):
+ if (dup_page.title(as_url=True)
+ == self.image.title(as_url=True)):
# the image itself, not report also this as duplicate
continue
repme += '\n** [[:{}{}]]'.format(
@@ -1259,9 +1257,9 @@
for template_selected in templatesInTheImageRaw:
tp = pywikibot.Page(self.site, template_selected)
for templateReal in self.licenses_found:
- if (tp.title(as_url=True, with_ns=False).lower() ==
- templateReal.title(as_url=True,
- with_ns=False).lower()):
+ if (tp.title(as_url=True, with_ns=False).lower()
+ == templateReal.title(as_url=True,
+ with_ns=False).lower()):
if templateReal not in self.allLicenses:
self.allLicenses.append(templateReal)
break
@@ -1307,10 +1305,10 @@
self.some_problem = False
else:
if not self.seems_ok and self.license_found:
- rep_text_license_fake = ((self.list_entry +
- "seems to have a ''fake license'', "
- 'license detected: '
- '<nowiki>%s</nowiki>') %
+ rep_text_license_fake = ((self.list_entry
+ + "seems to have a ''fake license'',"
+ ' license detected:'
+ ' <nowiki>%s</nowiki>') %
(self.imageName, self.license_found))
printWithTimeZone(
'{} seems to have a fake license: {}, reporting...'
diff --git a/scripts/isbn.py b/scripts/isbn.py
index f6912db..33fa573 100755
--- a/scripts/isbn.py
+++ b/scripts/isbn.py
@@ -1305,8 +1305,8 @@
sum += (i + 1) * int(self.digits()[i])
checksum = sum % 11
lastDigit = self.digits()[-1]
- if not ((checksum == 10 and lastDigit in 'Xx') or
- (lastDigit.isdigit() and checksum == int(lastDigit))):
+ if not (checksum == 10 and lastDigit in 'Xx'
+ or lastDigit.isdigit() and checksum == int(lastDigit)):
raise InvalidIsbnException('The ISBN checksum of {0} is incorrect.'
.format(self.code))

@@ -1653,9 +1653,9 @@
# FIXME: See T85483 and run() in WikidataBot
site = pywikibot.Site()
data_site = site.data_repository()
- use_wikibase = (data_site is not None and
- data_site.family == site.family and
- data_site.code == site.code)
+ use_wikibase = (data_site is not None
+ and data_site.family == site.family
+ and data_site.code == site.code)

for arg in local_args:
if arg.startswith('-prop-isbn-10:'):
diff --git a/scripts/match_images.py b/scripts/match_images.py
index b923d16..1c15517 100755
--- a/scripts/match_images.py
+++ b/scripts/match_images.py
@@ -83,8 +83,8 @@
bottomleftScore = match_images(imageA_bottomleft, imageB_bottomleft)
bottomrightScore = match_images(imageA_bottomright, imageB_bottomright)
centerScore = match_images(imageA_center, imageB_center)
- averageScore = (wholeScore + topleftScore + toprightScore +
- bottomleftScore + bottomrightScore + centerScore) / 6
+ averageScore = (wholeScore + topleftScore + toprightScore
+ + bottomleftScore + bottomrightScore + centerScore) / 6

pywikibot.output('Whole image {0:>7.2%}\n'
'Top left of image {1:>7.2%}\n'

To view, visit change 474525. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I2d1924f71b0a669b650fbf17c053f28c1e5ef0ee
Gerrit-Change-Number: 474525
Gerrit-PatchSet: 5
Gerrit-Owner: Nils ANDRE <nils.andre.chang@gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick@gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki@tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)