jenkins-bot merged this change.
Revert "[FIX] W503 errors"
Rule W503 (line break before binary operator)
is against current PEP 8 recommendation
This reverts commit 54e9727c0d5a99119be1f230d4498d8d0bc4efd6.
Change-Id: I7bbcffc7c5d3488e2db8e746eb231e61d46e4385
---
M generate_family_file.py
M pywikibot/data/api.py
M pywikibot/page.py
M pywikibot/site.py
M pywikibot/userinterfaces/win32_unicode.py
M scripts/archivebot.py
M scripts/category_redirect.py
M scripts/commonscat.py
M scripts/solve_disambiguation.py
M scripts/transferbot.py
M tests/__init__.py
M tests/aspects.py
M tests/script_tests.py
13 files changed, 57 insertions(+), 57 deletions(-)
diff --git a/generate_family_file.py b/generate_family_file.py
index cee2ad5..eef45c1 100755
--- a/generate_family_file.py
+++ b/generate_family_file.py
@@ -105,8 +105,8 @@
print(wiki['prefix'], wiki['url'])
do_langs = raw_input("Which languages do you want: ")
self.langs = [wiki for wiki in self.langs
- if wiki['prefix'] in do_langs or
- wiki['url'] == w.iwpath]
+ if wiki['prefix'] in do_langs
+ or wiki['url'] == w.iwpath]
else:
self.langs = [wiki for wiki in self.langs
if wiki[u'url'] == w.iwpath]
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 29030fe..c099574 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -630,8 +630,8 @@
params['modules'] = module_batch
else:
params['modules'] = [mod for mod in module_batch
- if not mod.startswith('query+') and
- mod not in self.root_modules]
+ if not mod.startswith('query+')
+ and mod not in self.root_modules]
params['querymodules'] = [mod[6:] for mod in module_batch
if mod.startswith('query+')]
@@ -1460,8 +1460,8 @@
self["assert"] = 'user' # make sure user is logged in
if (self.site.protocol() == 'http' and (config.use_SSL_always or (
- self.action == 'login' and config.use_SSL_onlogin)) and
- self.site.family.name in config.available_ssl_project):
+ self.action == 'login' and config.use_SSL_onlogin))
+ and self.site.family.name in config.available_ssl_project):
self.site = EnableSSLSiteWrapper(self.site)
@classmethod
@@ -1767,9 +1767,9 @@
def __str__(self):
"""Return a string representation."""
- return unquote(self.site.scriptpath() +
- '/api.php?' +
- self._http_param_string())
+ return unquote(self.site.scriptpath()
+ + '/api.php?'
+ + self._http_param_string())
def __repr__(self):
"""Return internal representation."""
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 46a43e1..a424abe 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -338,8 +338,8 @@
target_family = config.family
if forceInterwiki or \
(allowInterwiki and
- (self.site.family.name != target_family or
- self.site.code != target_code)):
+ (self.site.family.name != target_family
+ or self.site.code != target_code)):
if self.site.family.name != target_family \
and self.site.family.name != self.site.code:
title = u'%s:%s:%s' % (self.site.family.name,
@@ -1941,8 +1941,8 @@
"""
if hasattr(self, "_deletedRevs"):
if timestamp in self._deletedRevs and (
- (not retrieveText) or
- 'content' in self._deletedRevs[timestamp]):
+ (not retrieveText)
+ or 'content' in self._deletedRevs[timestamp]):
return self._deletedRevs[timestamp]
for item in self.site.deletedrevs(self, start=timestamp,
get_text=retrieveText, total=1):
@@ -5622,11 +5622,11 @@
# * with 'relative' URLs. Forbid them explicitly.
if u'.' in t and (
- t in ('.', '..') or
- t.startswith(('./', '../')) or
- u'/./' in t or
- u'/../' in t or
- t.endswith(('/.', '/..'))
+ t in ('.', '..')
+ or t.startswith(('./', '../'))
+ or '/./' in t
+ or '/../' in t
+ or t.endswith(('/.', '/..'))
):
raise pywikibot.InvalidTitle(
u"(contains . / combinations): '%s'"
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 20c6d62..c19ec20 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -632,8 +632,8 @@
# int(None) raises TypeError; however, bool needs special handling.
result = [NotImplemented if isinstance(ns, bool) else
NamespacesDict._lookup_name(ns, namespaces)
- if isinstance(ns, basestring) and
- not ns.lstrip('-').isdigit() else
+ if isinstance(ns, basestring)
+ and not ns.lstrip('-').isdigit() else
namespaces[int(ns)] if int(ns) in namespaces
else None
for ns in identifiers]
@@ -2234,8 +2234,8 @@
@rtype: C{set} of L{Namespace}
"""
# TODO: Integrate into _userinfo
- if (force or not hasattr(self, '_useroptions') or
- self.user() != self._useroptions['_name']):
+ if (force or not hasattr(self, '_useroptions')
+ or self.user() != self._useroptions['_name']):
uirequest = self._simple_request(
action="query",
meta="userinfo",
@@ -6392,8 +6392,8 @@
final_request['filekey'] = _file_key
else:
file_contents = f.read()
- filetype = (mimetypes.guess_type(source_filename)[0] or
- 'application/octet-stream')
+ filetype = (mimetypes.guess_type(source_filename)[0]
+ or 'application/octet-stream')
final_request.mime_params = {
'file': (file_contents, filetype.split('/'),
{'filename': mime_filename})
diff --git a/pywikibot/userinterfaces/win32_unicode.py b/pywikibot/userinterfaces/win32_unicode.py
index 19ed9bb..41667b6 100755
--- a/pywikibot/userinterfaces/win32_unicode.py
+++ b/pywikibot/userinterfaces/win32_unicode.py
@@ -280,8 +280,8 @@
"""Return whether the handle is not to a console."""
if handle == INVALID_HANDLE_VALUE or handle is None:
return True
- return ((GetFileType(handle) & ~FILE_TYPE_REMOTE) != FILE_TYPE_CHAR or
- GetConsoleMode(handle, byref(DWORD())) == 0)
+ return ((GetFileType(handle) & ~FILE_TYPE_REMOTE) != FILE_TYPE_CHAR
+ or GetConsoleMode(handle, byref(DWORD())) == 0)
old_stdin_fileno = old_fileno('in')
old_stdout_fileno = old_fileno('out')
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index 33000c9..21a8eaa 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -579,8 +579,8 @@
def saveables(self):
"""Return a list of saveable attributes."""
- return [a for a in self.attributes if self.attributes[a][1] and
- a != 'maxage']
+ return [a for a in self.attributes if self.attributes[a][1]
+ and a != 'maxage']
def attr2text(self):
"""Return a template with archiver saveable attributes."""
diff --git a/scripts/category_redirect.py b/scripts/category_redirect.py
index 285651c..4040eaf 100755
--- a/scripts/category_redirect.py
+++ b/scripts/category_redirect.py
@@ -443,12 +443,12 @@
newredirs.sort()
comment = i18n.twtranslate(self.site, self.maint_comment)
self.log_page.text = (u"\n== %i-%02i-%02iT%02i:%02i:%02iZ ==\n"
- % time.gmtime()[:6] +
- u'\n'.join(self.log_text) +
- u'\n* New redirects since last report:\n' +
- u'\n'.join(newredirs) +
- u'\n' + u'\n'.join(self.problems) +
- u'\n' + self.get_log_text())
+ % time.gmtime()[:6]
+ + '\n'.join(self.log_text)
+ + '\n* New redirects since last report:\n'
+ + '\n'.join(newredirs)
+ + '\n' + '\n'.join(self.problems)
+ + '\n' + self.get_log_text())
self.log_page.save(comment)
if self.edit_requests:
edit_request_page.text = (self.edit_request_text
diff --git a/scripts/commonscat.py b/scripts/commonscat.py
index c7083b9..e1c37df 100755
--- a/scripts/commonscat.py
+++ b/scripts/commonscat.py
@@ -392,8 +392,8 @@
ipage = pywikibot.page.Page(ipageLink)
pywikibot.log("Looking for template on %s" % (ipage.title()))
try:
- if (not ipage.exists() or ipage.isRedirectPage() or
- ipage.isDisambig()):
+ if (not ipage.exists() or ipage.isRedirectPage()
+ or ipage.isDisambig()):
continue
commonscatLink = self.getCommonscatLink(ipage)
if not commonscatLink:
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index dc82dfb..2d662e8 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -944,8 +944,8 @@
new_page_title = answer[1]
repPl = pywikibot.Page(pywikibot.Link(new_page_title,
disambPage.site))
- if (new_page_title[0].isupper() or
- link_text[0].isupper()):
+ if (new_page_title[0].isupper()
+ or link_text[0].isupper()):
new_page_title = repPl.title()
else:
new_page_title = repPl.title()
@@ -956,8 +956,8 @@
newlink = "[[%s%s]]%s" % (new_page_title,
section,
trailing_chars)
- elif replaceit or (new_page_title == link_text and
- not section):
+ elif replaceit or (new_page_title == link_text
+ and not section):
newlink = "[[%s]]" % new_page_title
# check if we can create a link with trailing characters
# instead of a pipelink
@@ -1006,8 +1006,8 @@
"""
if disambPage.isRedirectPage() and not self.primary:
- if (disambPage.site.lang in self.primary_redir_template and
- self.primary_redir_template[disambPage.site.lang]
+ if (disambPage.site.lang in self.primary_redir_template
+ and self.primary_redir_template[disambPage.site.lang]
in disambPage.templates()):
baseTerm = disambPage.title()
for template in disambPage.templatesWithParams():
diff --git a/scripts/transferbot.py b/scripts/transferbot.py
index 092bad1..f6d2ee3 100755
--- a/scripts/transferbot.py
+++ b/scripts/transferbot.py
@@ -135,8 +135,8 @@
for page in gen:
targetpage = pywikibot.Page(tosite, prefix + page.title())
- edithistpage = pywikibot.Page(tosite, prefix + page.title() +
- '/edithistory')
+ edithistpage = pywikibot.Page(tosite, prefix + page.title()
+ + '/edithistory')
summary = 'Moved page from {old} ([[{new}/edithistory|history]])'\
.format(old=page.title(asLink=True, insite=tosite),
new=targetpage.title() if not
diff --git a/tests/__init__.py b/tests/__init__.py
index 75404a3..5050b9f 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -169,13 +169,13 @@
"""List tests which are to be executed."""
dir_list = os.listdir(join_tests_path())
all_test_list = [name[0:-9] for name in dir_list # strip '_tests.py'
- if name.endswith('_tests.py') and
- not name.startswith('_')] # skip __init__.py and _*
+ if name.endswith('_tests.py')
+ and not name.startswith('_')] # skip __init__.py and _*
unknown_test_modules = [name
for name in all_test_list
- if name not in library_test_modules and
- name not in script_test_modules]
+ if name not in library_test_modules
+ and name not in script_test_modules]
return unknown_test_modules
diff --git a/tests/aspects.py b/tests/aspects.py
index f51a627..268e460 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -845,9 +845,9 @@
if 'family' in dct or 'code' in dct:
dct['site'] = True
- if (('sites' not in dct or not len(dct['sites'])) and
- 'family' in dct and
- 'code' in dct and dct['code'] != '*'):
+ if (('sites' not in dct or not len(dct['sites']))
+ and 'family' in dct
+ and 'code' in dct and dct['code'] != '*'):
# Add entry to self.sites
dct['sites'] = {
str(dct['family'] + ':' + dct['code']): {
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 7a70d5e..6e290d1 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -192,8 +192,8 @@
tests = (['test__login'] +
['test_' + name
for name in sorted(script_list)
- if name != 'login' and
- name not in unrunnable_script_list
+ if name != 'login'
+ and name not in unrunnable_script_list
])
test_list = ['tests.script_tests.TestScriptHelp.' + name
@@ -202,10 +202,10 @@
tests = (['test__login'] +
['test_' + name
for name in sorted(script_list)
- if name != 'login' and
- name not in failed_dep_script_list and
- name not in unrunnable_script_list and
- (enable_autorun_tests or name not in auto_run_script_list)
+ if name != 'login'
+ and name not in failed_dep_script_list
+ and name not in unrunnable_script_list
+ and (enable_autorun_tests or name not in auto_run_script_list)
])
test_list += ['tests.script_tests.TestScriptSimulate.' + name
To view, visit change 425840. To unsubscribe, visit settings.