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

Change subject: pep8: more whitespaces fixes
......................................................................


pep8: more whitespaces fixes

count   err# description

1       E222 multiple spaces after operator
1       E225 missing whitespace around operator
1       W291 trailing whitespace
2       E262 inline comment should start with '# '
3       E302 expected 2 blank lines, found 1
3       E303 too many blank lines (2)
3       W293 blank line contains whitespace
31      E261 at least two spaces before inline comment

Change-Id: I64bdd669ca0a8e41065b81a65167a62b65ee6eb6
---
M pywikibot/page.py
M pywikibot/site.py
M tests/site_tests.py
3 files changed, 49 insertions(+), 51 deletions(-)

Approvals:
  Merlijn van Deen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/page.py b/pywikibot/page.py
index 8816da2..53c2fce 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -368,12 +368,12 @@
     def expand_text(self, refresh=False):
         """Return the page text with all templates expanded."""
         if not hasattr(self, "_expanded_text") or (self._expanded_text is 
None) or refresh:
-            req = pywikibot.data.api.Request(action="expandtemplates", 
+            req = pywikibot.data.api.Request(action="expandtemplates",
                                              text=self.text,
                                              
title=self.title(withSection=False),
                                              site=self.site)
             self._expanded_text = req.submit()["expandtemplates"]["*"]
-            
+
         return self._expanded_text
 
     def userName(self):
@@ -499,7 +499,7 @@
 
         """
         ns = self.namespace()
-        if ns < 0: # Special page
+        if ns < 0:  # Special page
             return None
         if self.isTalkPage():
             if self.namespace() == 1:
@@ -691,7 +691,7 @@
 
         """
         # TODO: move this to Site object?
-        if config.ignore_bot_templates: #Check the "master ignore switch"
+        if config.ignore_bot_templates:  # Check the "master ignore switch"
             return True
         username = self.site.user()
         try:
@@ -803,7 +803,7 @@
             pywikibot.log(u"Error saving page %s (%s)\n" % (link, err),
                           exc_info=True)
             if not callback and not async:
-                raise pywikibot.PageNotSaved("%s: %s" %(link, err))
+                raise pywikibot.PageNotSaved("%s: %s" % (link, err))
         if callback:
             callback(self, err)
 
@@ -1474,7 +1474,7 @@
 
         """
         if not self.isCategory():
-            return None # should this raise an exception??
+            return None  # should this raise an exception??
         try:
             return self.site.categoryinfo(self)
         except NotImplementedError:
@@ -2207,7 +2207,7 @@
                 raise err
 
     @deprecated("contributions")
-    @deprecate_arg("limit", "total") # To be consistent with rest of framework
+    @deprecate_arg("limit", "total")  # To be consistent with rest of framework
     def editedPages(self, total=500):
         """ Deprecated function that wraps 'contributions' for backwards
         compatibility. Yields pywikibot.Page objects that this user has
@@ -2220,7 +2220,7 @@
         for item in self.contributions(total=total):
             yield item[0]
 
-    @deprecate_arg("limit", "total") # To be consistent with rest of framework
+    @deprecate_arg("limit", "total")  # To be consistent with rest of framework
     @deprecate_arg("namespace", "namespaces")
     def contributions(self, total=500, namespaces=[]):
         """ Yield tuples describing this user edits with an upper bound of
@@ -2755,7 +2755,6 @@
         wrap = {'mainsnak': data}
         return Claim.fromJSON(site, wrap)
 
-
     def setTarget(self, value):
         """
         Sets the target to the passed value.
@@ -2845,8 +2844,6 @@
         else:
             raise NotImplementedError('%s datatype is not supported yet.' % 
self.getType())
         return value
-
-
 
 
 class Revision(object):
@@ -2988,7 +2985,7 @@
                 # remove any subsequent whitespace
                 t = t.lstrip(u":").lstrip(u" ")
                 continue
-            prefix = t[ :t.index(u":")].lower() # part of text before :
+            prefix = t[ :t.index(u":")].lower()  # part of text before :
             ns = self._source.ns_index(prefix)
             if ns:
                 # The prefix is a namespace in the source wiki
@@ -3264,6 +3261,7 @@
 
 # Utility functions for parsing page titles
 
+
 def html2unicode(text, ignore = None):
     """Return text, replacing HTML entities by equivalent unicode 
characters."""
     if ignore is None:
@@ -3275,33 +3273,33 @@
     # These characters are Html-illegal, but sadly you *can* find some of
     # these and converting them to unichr(decimal) is unsuitable
     convertIllegalHtmlEntities = {
-        128 : 8364, # €
-        130 : 8218, # ‚
-        131 : 402,  # ƒ
-        132 : 8222, # „
-        133 : 8230, # …
-        134 : 8224, # †
-        135 : 8225, # ‡
-        136 : 710,  # ˆ
-        137 : 8240, # ‰
-        138 : 352,  # Š
-        139 : 8249, # ‹
-        140 : 338,  # Œ
-        142 : 381,  # Ž
-        145 : 8216, # ‘
-        146 : 8217, # ’
-        147 : 8220, # “
-        148 : 8221, # ”
-        149 : 8226, # •
-        150 : 8211, # –
-        151 : 8212, # —
-        152 : 732,  # ˜
-        153 : 8482, # ™
-        154 : 353,  # š
-        155 : 8250, # ›
-        156 : 339,  # œ
-        158 : 382,  # ž
-        159 : 376   # Ÿ
+        128 : 8364,  # €
+        130 : 8218,  # ‚
+        131 : 402,   # ƒ
+        132 : 8222,  # „
+        133 : 8230,  # …
+        134 : 8224,  # †
+        135 : 8225,  # ‡
+        136 : 710,   # ˆ
+        137 : 8240,  # ‰
+        138 : 352,   # Š
+        139 : 8249,  # ‹
+        140 : 338,   # Œ
+        142 : 381,   # Ž
+        145 : 8216,  # ‘
+        146 : 8217,  # ’
+        147 : 8220,  # “
+        148 : 8221,  # ”
+        149 : 8226,  # •
+        150 : 8211,  # –
+        151 : 8212,  # —
+        152 : 732,   # ˜
+        153 : 8482,  # ™
+        154 : 353,   # š
+        155 : 8250,  # ›
+        156 : 339,   # œ
+        158 : 382,   # ž
+        159 : 376    # Ÿ
     }
     #ensuring that illegal &#129; &#141; and &#157, which have no known values,
     #don't get converted to unichr(129), unichr(141) or unichr(157)
@@ -3339,6 +3337,7 @@
             found = False
     return result
 
+
 def url2unicode(title, site, site2 = None):
     """Convert url-encoded text to unicode using site's encoding.
 
diff --git a/pywikibot/site.py b/pywikibot/site.py
index ec0f0b4..8f8c217 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2818,7 +2818,7 @@
             "User %(user)s not allowed to edit through the API",
         "alreadyrolled":
             "Page [[%(title)s]] already rolled back; action aborted.",
-    } # other errors shouldn't arise because we check for those errors
+    }  # other errors shouldn't arise because we check for those errors
 
     def rollbackpage(self, page, summary=u''):
         """Roll back page to version before last user's edits.
@@ -2883,7 +2883,7 @@
             "User %(user)s not authorized to delete pages on %(site)s wiki.",
         "cantdelete":
             "Could not delete [[%(title)s]]. Maybe it was deleted already.",
-    } # other errors shouldn't occur because of pre-submission checks
+    }  # other errors shouldn't occur because of pre-submission checks
 
     def deletepage(self, page, summary):
         """Delete page from the wiki. Requires appropriate privilege level.
@@ -2994,7 +2994,7 @@
         NOTE 2: it returns the image title WITHOUT the image namespace.
 
         """
-        if hash_found is None: # If the hash is none return None and not 
continue
+        if hash_found is None:  # If the hash is none return None and not 
continue
             return None
         return [image.title(withNamespace=False)
                 for image in self.allimages(sha1=hash_found)]
@@ -3002,7 +3002,6 @@
     @deprecated('Site().getFilesFromAnHash')
     def getImagesFromAnHash(self, hash_found=None):
         return self.getFilesFromAnHash(hash_found)
-
 
     def upload(self, imagepage, source_filename=None, source_url=None,
                comment=None, watch=False, ignore_warnings=False):
@@ -3108,7 +3107,7 @@
     @deprecate_arg("repeat", None)
     @deprecate_arg("namespace", "namespaces")
     @deprecate_arg("rc_show", None)
-    @deprecate_arg("get_redirect", None) #20120822
+    @deprecate_arg("get_redirect", None)  # 20120822
     def newpages(self, user=None, returndict=False,
                  start=None, end=None, reverse=False, showBot=False,
                  showRedirects=False, excludeuser=None,
@@ -3435,7 +3434,7 @@
         #Store it for 100 years
         req = api.CachedRequest(expiry, site=self, **params)
         data = req.submit()
-        dtype =  data['entities'][prop.getID()]['datatype']
+        dtype = data['entities'][prop.getID()]['datatype']
         if dtype == 'globe-coordinate':
             dtype = 'globecoordinate'
             #TODO Fix this
diff --git a/tests/site_tests.py b/tests/site_tests.py
index cb29a0e..0877653 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -29,8 +29,8 @@
         global mysite, mainpage, imagepage
         mysite = pywikibot.Site(cls.code, cls.family)
         mainpage = pywikibot.Page(pywikibot.Link("Main Page", mysite))
-        imagepage = iter(mainpage.imagelinks()).next() # 1st image on main page
-        
+        imagepage = iter(mainpage.imagelinks()).next()  # 1st image on main 
page
+
     @classmethod
     def tearDownClass(cls):
         unpatch_request
@@ -56,7 +56,7 @@
         self.assertType(mysite.linktrail(), basestring)
         self.assertType(mysite.redirect(default=True), basestring)
         self.assertType(mysite.disambcategory(), pywikibot.Category)
-        self.assertEqual(mysite.linkto("foo"), u"[[Foo]]") # deprecated
+        self.assertEqual(mysite.linkto("foo"), u"[[Foo]]")  # deprecated
         self.assertFalse(mysite.isInterwikiLink("foo"))
         self.assertType(mysite.redirectRegex().pattern, basestring)
         self.assertType(mysite.category_on_one_line(), bool)
@@ -85,14 +85,14 @@
         ipf = mysite.interwiki_putfirst()
         if ipf:  # Not all languages use this
             self.assertType(ipf, list)
-        
+
         for item in mysite.validLanguageLinks():
             self.assertTrue(item in langs, item)
 
     def testNamespaceMethods(self):
         """Test cases for methods manipulating namespace names"""
 
-        builtins = {'Talk': 1, # these should work in any MW wiki
+        builtins = {'Talk': 1,  # these should work in any MW wiki
                     'User': 2,
                     'User talk': 3,
                     'Project': 4,
@@ -185,7 +185,7 @@
     def testTokens(self):
         """Test ability to get page tokens"""
 
-        for ttype in ("edit", "move"): # token types for non-sysops
+        for ttype in ("edit", "move"):  # token types for non-sysops
             self.assertType(mysite.token(mainpage, ttype), basestring)
         self.assertRaises(KeyError, mysite.token, mainpage, "invalidtype")
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I64bdd669ca0a8e41065b81a65167a62b65ee6eb6
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to