jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/474528 )
Change subject: [PEP8] Fix W504 errors in pywikibot ......................................................................
[PEP8] Fix W504 errors in pywikibot
Fixed the W504 error occurrences in the following files: - pywikibot/cosmetic_changes.py - pywikibot/login.py - pywikibot/pagegenerators.py
Bug: T207836 Change-Id: I2b2baf7bb05b6cee41439e27b121af9e8af1df56 --- M pywikibot/cosmetic_changes.py M pywikibot/login.py M pywikibot/pagegenerators.py 3 files changed, 19 insertions(+), 18 deletions(-)
Approvals: Xqt: Looks good to me, but someone else must approve Rafidaslam: Looks good to me, but someone else must approve Dvorapa: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py index 7b389a4..327d7a2 100755 --- a/pywikibot/cosmetic_changes.py +++ b/pywikibot/cosmetic_changes.py @@ -541,8 +541,8 @@ if not trailingChars: titleLength = len(titleWithSection) titleWithSection = titleWithSection.rstrip() - hadTrailingSpaces = (len(titleWithSection) != - titleLength) + hadTrailingSpaces = (len(titleWithSection) + != titleLength)
# Convert URL-encoded characters to unicode from pywikibot.page import url2unicode @@ -586,8 +586,9 @@ newLink = '[[%s]]' % label # Check if we can create a link with trailing characters # instead of a pipelink - elif (firstcase_label.startswith(firstcase_title) and - trailR.sub('', label[len(titleWithSection):]) == ''): + elif (firstcase_label.startswith(firstcase_title) + and trailR.sub('', + label[len(titleWithSection):]) == ''): newLink = '[[%s]]%s' % ( label[:len(titleWithSection)], label[len(titleWithSection):]) @@ -627,8 +628,8 @@ # note that the definition of 'letter' varies from language to language. linkR = re.compile( r'(?P<newline>[\n]*)[[(?P<titleWithSection>[^]|]+)' - r'(|(?P<label>[^]|]*))?]](?P<linktrail>' + - self.site.linktrail() + ')') + r'(|(?P<label>[^]|]*))?]](?P<linktrail>' + + self.site.linktrail() + ')')
text = textlib.replaceExcept(text, linkR, handleOneLink, ['comment', 'math', 'nowiki', 'pre', @@ -792,8 +793,8 @@ def replace_link(match): """Create a string to replace a single link.""" replacement = '[[' - if re.match(r'(?:' + '|'.join(list(self.site.namespaces[6]) + - list(self.site.namespaces[14])) + '):', + if re.match(r'(?:' + '|'.join(list(self.site.namespaces[6]) + + list(self.site.namespaces[14])) + '):', match.group('link')): replacement += ':' replacement += match.group('link') diff --git a/pywikibot/login.py b/pywikibot/login.py index 20740bc..7161118 100644 --- a/pywikibot/login.py +++ b/pywikibot/login.py @@ -266,9 +266,9 @@
code, family, username, password = ( self.site.code, self.site.family.name)[:4 - len(entry)] + entry - if (normalize_username(username) == self.username and - family == self.site.family.name and - code == self.site.code): + if (normalize_username(username) == self.username + and family == self.site.family.name + and code == self.site.code): if isinstance(password, basestring): self.password = password break diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py index 78ec1a7..14fe1fd 100644 --- a/pywikibot/pagegenerators.py +++ b/pywikibot/pagegenerators.py @@ -518,13 +518,13 @@ if self.limit: self.gens[i] = itertools.islice(self.gens[i], self.limit) if len(self.gens) == 0: - if (self.titlefilter_list or - self.titlenotfilter_list or - self.articlefilter_list or - self.claimfilter_list or - self.catfilter_list or - self.subpage_max_depth is not None or - self.qualityfilter_list): + if (self.titlefilter_list + or self.titlenotfilter_list + or self.articlefilter_list + or self.claimfilter_list + or self.catfilter_list + or self.subpage_max_depth is not None + or self.qualityfilter_list): pywikibot.warning( 'filter(s) specified but no generators.') return None
pywikibot-commits@lists.wikimedia.org