Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/95812


Change subject: [PEP8] pep8 changes
......................................................................

[PEP8] pep8 changes

Change-Id: I9f6283462b2bed90b5d737ed976521901fb17506
---
M commons_category_redirect.py
1 file changed, 27 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat 
refs/changes/12/95812/1

diff --git a/commons_category_redirect.py b/commons_category_redirect.py
index 534bd13..b1a06a5 100644
--- a/commons_category_redirect.py
+++ b/commons_category_redirect.py
@@ -1,60 +1,67 @@
 #!/usr/bin/python
 # -*- coding: utf-8  -*-
 """
-Script to clean up 
http://commons.wikimedia.org/wiki/Category:Non-empty_category_redirects
+Script to clean up
+http://commons.wikimedia.org/wiki/Category:Non-empty_category_redirects
 
-Moves all images, pages and categories in redirect categories to the target 
category.
+Moves all images, pages and categories in redirect categories to the target
+category.
 
 """
 
 #
 # (C) Multichill, 2008
-# (C) Pywikipedia team, 2008-2011
+# (C) Pywikibot team, 2008-2013
 #
 # Distributed under the terms of the MIT license.
 #
 __version__ = '$Id$'
 
-import wikipedia as pywikibot
-import config, catlib
-from category import *
 from datetime import datetime
 from datetime import timedelta
 
-redirect_templates = [u'Category redirect', u'Categoryredirect', u'See cat', 
u'Seecat', u'Catredirect', u'Cat redirect', u'CatRed', u'Catredir']
+import wikipedia as pywikibot
+import config
+import catlib
+from category import *
+
+redirect_templates = [u'Category redirect', u'Categoryredirect', u'See cat',
+                      u'Seecat', u'Catredirect', u'Cat redirect', u'CatRed',
+                      u'Catredir']
 move_message = u'Moving from [[%s|%s]] to [[%s|%s]] (following 
[[Template:Category redirect|category redirect]])'
-cooldown = 7 # days
+cooldown = 7  # days
+
 
 def get_redirect_cat(category=None):
-    '''
-    Return the target category
-    '''
+    """ Return the target category """
     destination = None
     site = pywikibot.getSite(u'commons', u'commons')
     for template in category.templatesWithParams():
         if ((template[0] in redirect_templates) and (len(template[1]) > 0)):
             #destination = template[1][0];
-            destination =catlib.Category(site, template[1][0])
+            destination = catlib.Category(site, template[1][0])
             if not destination.exists():
                 return None
     return destination
 
+
 def readyToEdit(old_category):
-    ''' If the category is edited more recenty than cooldown, return false,
+    """ If the category is edited more recenty than cooldown, return false,
     otherwise true.
 
-    '''
-    dateformat ="%Y%m%d%H%M%S"
+    """
+    dateformat = "%Y%m%d%H%M%S"
     today = datetime.now()
     deadline = today + timedelta(days=-cooldown)
     old_category.get()
     return (deadline.strftime(dateformat) > old_category.editTime())
 
+
 def main():
-    ''' Main loop. Loop over all categories of
+    """ Main loop. Loop over all categories of
     Category:Non-empty_category_redirects and move all content.
 
-    '''
+    """
 
     site = pywikibot.getSite(u'commons', u'commons')
     dirtycat = catlib.Category(site, u'Category:Non-empty category redirects')
@@ -62,8 +69,8 @@
     catbot = None
 
     for old_category in dirtycat.subcategories():
-        # We want to wait several days after the last edit before we start 
moving
-        # things around. This it to prevent edit wars and vandals.
+        # We want to wait several days after the last edit before we start
+        # moving things around. This it to prevent edit wars and vandals.
         if(readyToEdit(old_category)):
             destination = get_redirect_cat(old_category)
             if destination:
@@ -94,6 +101,7 @@
         except:
             pywikibot.output(u'Dummy edit at %s failed' % old_category.title())
 
+
 if __name__ == "__main__":
     try:
         main()

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f6283462b2bed90b5d737ed976521901fb17506
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <i...@gno.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to