jenkins-bot has submitted this change and it was merged.

Change subject: Fix indents and enable E122 and E127 (mandatory)
......................................................................


Fix indents and enable E122 and E127 (mandatory)

Change-Id: Ib1a0e42e10c78eb73d0deb376496c6f5bf56cb48
---
M pywikibot/bot_choice.py
M pywikibot/comms/rcstream.py
M pywikibot/comms/threadedhttp.py
M pywikibot/config2.py
M pywikibot/data/api.py
M pywikibot/diff.py
M pywikibot/page.py
M pywikibot/textlib.py
M scripts/add_text.py
M scripts/category.py
M scripts/clean_sandbox.py
M scripts/flickrripper.py
M scripts/imagerecat.py
M scripts/pagefromfile.py
M scripts/upload.py
M tox.ini
16 files changed, 48 insertions(+), 44 deletions(-)

Approvals:
  John Vandenberg: Looks good to me, but someone else must approve
  XZise: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/bot_choice.py b/pywikibot/bot_choice.py
index 3db1958..5a56915 100755
--- a/pywikibot/bot_choice.py
+++ b/pywikibot/bot_choice.py
@@ -111,7 +111,7 @@
             shortcut = self.shortcut.upper()
         if index >= 0:
             return '{0}[{1}]{2}'.format(self.option[:index], shortcut,
-                                         self.option[index + 
len(self.shortcut):])
+                                        self.option[index + 
len(self.shortcut):])
         else:
             return '{0} [{1}]'.format(self.option, shortcut)
 
diff --git a/pywikibot/comms/rcstream.py b/pywikibot/comms/rcstream.py
index 7f15404..710163d 100644
--- a/pywikibot/comms/rcstream.py
+++ b/pywikibot/comms/rcstream.py
@@ -103,7 +103,7 @@
 
             def on_connect(self):
                 debug('Connected to %r; subscribing to %s'
-                          % (thread, thread.wikihost),
+                      % (thread, thread.wikihost),
                       _logger)
                 self.emit('subscribe', thread.wikihost)
                 debug('Subscribed to %s' % thread.wikihost, _logger)
diff --git a/pywikibot/comms/threadedhttp.py b/pywikibot/comms/threadedhttp.py
index 786d521..6c6f72a 100644
--- a/pywikibot/comms/threadedhttp.py
+++ b/pywikibot/comms/threadedhttp.py
@@ -138,9 +138,10 @@
             if (self.header_encoding and codecs.lookup(self.header_encoding) !=
                     (codecs.lookup(charset) if charset else None)):
                 if charset:
-                    pywikibot.warning(u'Encoding "{0}" requested but "{1}" '
-                                       'received in the header.'.format(
-                        charset, self.header_encoding))
+                    pywikibot.warning(
+                        'Encoding "{0}" requested but "{1}" '
+                        'received in the header.'.format(
+                            charset, self.header_encoding))
                 try:
                     # TODO: Buffer decoded content, weakref does remove it too
                     #       early (directly after this method)
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index fcbc8de..40a5031 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -881,7 +881,7 @@
 # System-level and User-level changes.
 # Store current variables and their types.
 _glv = dict((_key, _val) for _key, _val in globals().items()
-             if _key[0] != '_' and _key not in _imports)
+            if _key[0] != '_' and _key not in _imports)
 _gl = list(_glv.keys())
 _tp = {}
 for _key in _gl:
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 0d94f79..d864abf 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -611,7 +611,7 @@
             else:
                 params['modules'] = [mod for mod in module_batch
                                      if not mod.startswith('query+') and
-                                        mod not in self.root_modules]
+                                     mod not in self.root_modules]
                 params['querymodules'] = [mod[6:] for mod in module_batch
                                           if mod.startswith('query+')]
 
@@ -717,7 +717,7 @@
                     if param['name'] == 'generator':
                         break
                 assert param['name'] == 'generator' and \
-                       submodules >= set(param['type'])
+                    submodules >= set(param['type'])
 
     def _normalize_modules(self, modules):
         """Add query+ to any query module name not also in action modules."""
diff --git a/pywikibot/diff.py b/pywikibot/diff.py
index 9a5ec48..b1136b4 100644
--- a/pywikibot/diff.py
+++ b/pywikibot/diff.py
@@ -457,7 +457,8 @@
                         first = self.b[super_hunk[0].b_rng[0]]
                     hunk_list += [(status, index,
                                    Hunk.get_header_text(
-                                   *self._get_context_range(super_hunk), 
affix=''),
+                                       *self._get_context_range(super_hunk),
+                                       affix=''),
                                    mode, first)]
                     rng_width = max(len(hunk_list[-1][2]), rng_width)
                 line_template = ('{0}{1} {2: >' +
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 1f94132..278ed54 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2621,7 +2621,7 @@
                 # The complete list can be removed, it'll either yield all of
                 # them, or only a portion but will skip the rest anyway
                 cached += cache.pop(timestamp)[:None if total is None else
-                                                total - len(cached)]
+                                               total - len(cached)]
                 if total and len(cached) >= total:
                     break  # already got enough
             assert total is None or len(cached) <= total, \
@@ -3188,10 +3188,10 @@
             # if none of the above applies, this item is in an invalid state
             # which needs to be raise as an exception, but also logged in case
             # an exception handler is catching the generic Error.
-            pywikibot.error('%s is in invalid state' %
-                                            self.__class__.__name__)
-            raise pywikibot.Error('%s is in invalid state' %
-                                            self.__class__.__name__)
+            pywikibot.error('%s is in invalid state'
+                            % self.__class__.__name__)
+            raise pywikibot.Error('%s is in invalid state'
+                                  % self.__class__.__name__)
 
         return params
 
@@ -4008,7 +4008,7 @@
         @return: Claim
         """
         return Claim(self.site, self.getID(), datatype=self.type,
-                      *args, **kwargs)
+                     *args, **kwargs)
 
 
 class Claim(Property):
@@ -4199,7 +4199,7 @@
         value_class = self.types[self.type]
         if not isinstance(value, value_class):
             raise ValueError("%s is not type %s."
-                                 % (value, value_class))
+                             % (value, value_class))
         self.target = value
 
     def changeTarget(self, value=None, snaktype='value', **kwargs):
@@ -4773,7 +4773,7 @@
                 raise SiteDefinitionError(
                     u'{0} is not a local page on {1}, and the interwiki prefix 
'
                     '{2} is not supported by PyWikiBot!:\n{3}'.format(
-                    self._text, self._site, prefix, e))
+                        self._text, self._site, prefix, e))
             else:
                 t = t[t.index(u":"):].lstrip(u":").lstrip(u" ")
                 if first_other_site:
@@ -4781,7 +4781,7 @@
                         raise pywikibot.InvalidTitle(
                             u'{0} links to a non local site {1} via an '
                             'interwiki link to {2}.'.format(
-                            self._text, newsite, first_other_site))
+                                self._text, newsite, first_other_site))
                 elif newsite != self._source:
                     first_other_site = newsite
                 self._site = newsite
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index a0b4d99..88fc8ef 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -203,7 +203,7 @@
                 # extensions
                 if exc not in _regex_cache:
                     _regex_cache[exc] = re.compile(r'(?is)<%s>.*?</%s>'
-                                                    % (exc, exc))
+                                                   % (exc, exc))
                 result.append(_regex_cache[exc])
             # handle alias
             if exc == 'source':
@@ -446,6 +446,9 @@
         of it. It'll be just the marker if the separator is empty.
     @rtype: str
     """
+    # set to remove any number of separator occurrences plus arbitrary
+    # whitespace before, after, and between them,
+    # by allowing to include them into marker.
     if separator:
         firstinmarker = text.find(marker)
         firstinseparator = firstinmarker
diff --git a/scripts/add_text.py b/scripts/add_text.py
index 0fb2f28..0e81491 100755
--- a/scripts/add_text.py
+++ b/scripts/add_text.py
@@ -160,15 +160,17 @@
         result = re.findall(regexSkipUrl, site.getUrl(url))
         if result != []:
             pywikibot.output(
-u'''Exception! regex (or word) used with -exceptUrl is in the page. Skip!
-Match was: %s''' % result)
+                'Exception! regex (or word) used with -exceptUrl '
+                'is in the page. Skip!\n'
+                'Match was: %s' % result)
             return (False, False, always)
     if regexSkip is not None:
         result = re.findall(regexSkip, text)
         if result != []:
             pywikibot.output(
-u'''Exception! regex (or word) used with -except is in the page. Skip!
-Match was: %s''' % result)
+                'Exception! regex (or word) used with -except '
+                'is in the page. Skip!\n'
+                'Match was: %s' % result)
             return (False, False, always)
     # If not up, text put below
     if not up:
diff --git a/scripts/category.py b/scripts/category.py
index ad4d119..20eb622 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -633,7 +633,7 @@
         if not old_page.exists():
             # only warn if not a talk page
             log = (pywikibot.log if old_page.namespace() % 2 else
-                    pywikibot.warning)
+                   pywikibot.warning)
             log(u"Moving {0} '{1}' requested, but the page doesn't "
                 u"exist.".format(name, old_page.title()))
             move_possible = False
diff --git a/scripts/clean_sandbox.py b/scripts/clean_sandbox.py
index b6d9824..46d8c5c 100755
--- a/scripts/clean_sandbox.py
+++ b/scripts/clean_sandbox.py
@@ -169,7 +169,7 @@
         if not self.generator:
             if self.site.code not in sandboxTitle:
                 pywikibot.error(u'No generator is given for this site'
-                                 u'(%s), exiting.' % self.site)
+                                u'(%s), exiting.' % self.site)
                 raise RuntimeError
             local_sandbox_title = sandboxTitle[self.site.code]
             if not isinstance(local_sandbox_title, list):
@@ -206,8 +206,7 @@
                     if text.strip() == translatedContent.strip():
                         pywikibot.output(
                             u'The sandbox is still clean, no change 
necessary.')
-                    elif subst and \
-                         sandboxPage.userName() == self.site.user():
+                    elif subst and sandboxPage.userName() == self.site.user():
                         pywikibot.output(
                             u'The sandbox might be clean, no change 
necessary.')
                     elif pos != 0 and not subst:
diff --git a/scripts/flickrripper.py b/scripts/flickrripper.py
index cd79724..439c6ba 100755
--- a/scripts/flickrripper.py
+++ b/scripts/flickrripper.py
@@ -306,7 +306,7 @@
             if Tkdialog is not None and not autonomous:
                 try:
                     (newPhotoDescription, newFilename, skip) = Tkdialog(
-                    photoDescription, photo, filename).show_dialog()
+                        photoDescription, photo, filename).show_dialog()
                 except ImportError as e:
                     pywikibot.warning(e)
                     pywikibot.warning('Switching to autonomous mode.')
diff --git a/scripts/imagerecat.py b/scripts/imagerecat.py
index fd57caf..2e9f2ba 100755
--- a/scripts/imagerecat.py
+++ b/scripts/imagerecat.py
@@ -380,7 +380,7 @@
         cat = cat.replace('_', ' ')
         toFilter = toFilter + "[[Category:" + cat + "]]\n"
     parameters = urlencode({'source': toFilter.encode('utf-8'),
-                                   'bot': '1'})
+                            'bot': '1'})
     filterCategoriesRe = re.compile(r'\[\[Category:([^\]]*)\]\]')
     try:
         filterCategoriesPage = fetch(
diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
index 209355a..89bd55b 100755
--- a/scripts/pagefromfile.py
+++ b/scripts/pagefromfile.py
@@ -132,19 +132,20 @@
                 pywikibot.output(u"Page %s is redirect, skipping!" % title)
                 return
             pagecontents = page.get(get_redirect=True)
-            if self.getOption('nocontent') != u'':
-                if pagecontents.find(self.getOption('nocontent')) != -1 or \
-                pagecontents.find(self.getOption('nocontent').lower()) != -1:
-                    pywikibot.output(u'Page has %s so it is skipped' % 
self.getOption('nocontent'))
-                    return
+            nocontent = self.getOption('nocontent')
+            if nocontent and (
+                    nocontent in pagecontents or
+                    nocontent.lower() in pagecontents):
+                pywikibot.output('Page has %s so it is skipped' % nocontent)
+                return
             if self.getOption('append') == 'top':
                 pywikibot.output(u"Page %s already exists, appending on top!"
-                                     % title)
+                                 % title)
                 contents = contents + pagecontents
                 comment = comment_top
             elif self.getOption('append') == 'bottom':
                 pywikibot.output(u"Page %s already exists, appending on 
bottom!"
-                                     % title)
+                                 % title)
                 contents = pagecontents + contents
                 comment = comment_bottom
             elif self.getOption('force'):
diff --git a/scripts/upload.py b/scripts/upload.py
index b7ea3fa..abf0ff7 100755
--- a/scripts/upload.py
+++ b/scripts/upload.py
@@ -389,7 +389,7 @@
         except pywikibot.data.api.APIError as error:
             if error.code == u'uploaddisabled':
                 pywikibot.error("Upload error: Local file uploads are disabled 
on %s."
-                                  % site)
+                                % site)
             else:
                 pywikibot.error("Upload error: ", exc_info=True)
         except Exception:
diff --git a/tox.ini b/tox.ini
index d85d20b..e825833 100644
--- a/tox.ini
+++ b/tox.ini
@@ -38,9 +38,7 @@
     pywikibot/backports.py \
     pywikibot/bot.py \
     pywikibot/bot_choice.py \
-    pywikibot/comms/__init__.py \
-    pywikibot/comms/http.py \
-    pywikibot/comms/rcstream.py \
+    pywikibot/comms/ \
     pywikibot/compat/ \
     pywikibot/config2.py \
     pywikibot/daemonize.py \
@@ -61,8 +59,7 @@
     pywikibot/plural.py \
     pywikibot/textlib.py \
     pywikibot/throttle.py \
-    pywikibot/tools/__init__.py \
-    pywikibot/tools/ip.py \
+    pywikibot/tools/ \
     pywikibot/userinterfaces/__init__.py \
     pywikibot/userinterfaces/terminal_interface.py \
     pywikibot/weblib.py \
@@ -166,12 +163,12 @@
 commands = {posargs}
 
 [flake8]
-ignore = E122,E127,E241,E265,E402,E731
+ignore = E241,E265,E402,E731
 exclude = 
.tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/*
 max_line_length = 130
 
 [pep8]
-ignore = E122,E127,E241,E402,E731
+ignore = E241,E402,E731
 exclude = 
.tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/*
 max_line_length = 130
 

-- 
To view, visit https://gerrit.wikimedia.org/r/226261
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib1a0e42e10c78eb73d0deb376496c6f5bf56cb48
Gerrit-PatchSet: 11
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to