John Vandenberg has uploaded a new change for review.

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

Change subject: Pep257
......................................................................

Pep257

Change-Id: Iea114b85f8623451a551409f485ba7346536ebd0
---
M scripts/watchlist.py
1 file changed, 10 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/39/151039/1

diff --git a/scripts/watchlist.py b/scripts/watchlist.py
index c3d685c..7560c22 100755
--- a/scripts/watchlist.py
+++ b/scripts/watchlist.py
@@ -2,8 +2,8 @@
 """
 Allows access to the bot account's watchlist.
 
-The function refresh() downloads the current watchlist and saves it to disk. It
-is run automatically when a bot first tries to save a page retrieved. The
+The function refresh() downloads the current watchlist and saves it to disk.
+It is run automatically when a bot first tries to save a page retrieved. The
 watchlist can be updated manually by running this script. The list will also
 be reloaded automatically once a month.
 
@@ -36,6 +36,7 @@
 
 
 def get(site=None):
+    """Load the watchlist, fetching it if necessary."""
     if site is None:
         site = pywikibot.Site()
     if site in cache:
@@ -65,12 +66,13 @@
 
 
 def isWatched(pageName, site=None):
+    """Check whether a page is being watched."""
     watchlist = get(site)
     return pageName in watchlist
 
 
 def refresh(site, sysop=False):
-    # get watchlist special page's URL
+    """Fetch the watchlist."""
     if not site.logged_in(sysop=sysop):
         site.forceLogin(sysop=sysop)
 
@@ -105,16 +107,18 @@
     # The file is stored in the watchlists subdir. Create if necessary.
     f = open(config.datafilepath('watchlists',
                                  'watchlist-%s-%s%s.dat'
-                                 % (site.family.name, lang, '-sysop' if sysop 
else '')),
+                                 % (site.family.name, lang,
+                                    '-sysop' if sysop else '')),
              'w')
     pickle.dump(watchlist, f)
     f.close()
 
 
 def refresh_all(new=False, sysop=False):
+    """Fetch and locally cache several watchlists."""
     if new:
         pywikibot.output(
-            'Downloading All watchlists for your accounts in user-config.py')
+            'Downloading all watchlists for your accounts in user-config.py')
         for family in config.usernames:
             for lang in config.usernames[family]:
                 refresh(pywikibot.Site(lang, family), sysop=sysop)
@@ -137,6 +141,7 @@
 
 
 def main():
+    """ Script entry point. """
     local_args = pywikibot.handleArgs()
     all = False
     new = False

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea114b85f8623451a551409f485ba7346536ebd0
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jay...@gmail.com>

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

Reply via email to