jenkins-bot merged this change.

View Change

Approvals: Huji: Looks good to me, approved jenkins-bot: Verified
[cleanup] Cleanup sysop option in watchlist.py

config.sysopnames is deprecated since 6f0cafd

- Remove undocumented -sysop option
- rename option variables

Change-Id: Idd35db2937629247351f45a3e26a4f0b09d59248
---
M scripts/watchlist.py
1 file changed, 16 insertions(+), 26 deletions(-)

diff --git a/scripts/watchlist.py b/scripts/watchlist.py
index 298de83..08fd6cf 100755
--- a/scripts/watchlist.py
+++ b/scripts/watchlist.py
@@ -18,7 +18,7 @@
"""
#
# (C) Daniel Herding, 2005
-# (C) Pywikibot team, 2005-2019
+# (C) Pywikibot team, 2005-2020
#
# Distributed under the terms of the MIT license.
#
@@ -27,11 +27,8 @@
import os

import pywikibot
-
from pywikibot import config
-
from pywikibot.data.api import CachedRequest
-
from scripts.maintenance.cache import CacheEntry


@@ -49,13 +46,13 @@
return pageName in watchlist


-def refresh(site, sysop=False):
+def refresh(site):
"""Fetch the watchlist."""
pywikibot.output('Retrieving watchlist for {0}.'.format(str(site)))
- return list(site.watched_pages(sysop=sysop, force=True))
+ return list(site.watched_pages(force=True))


-def refresh_all(sysop=False):
+def refresh_all():
"""Reload watchlists for all wikis where a watchlist is already present."""
cache_path = CachedRequest._get_cache_dir()
files = os.listdir(cache_path)
@@ -66,22 +63,18 @@
entry.parse_key()
entry._rebuild()
if entry.site not in seen and 'watchlistraw' in entry._data:
- refresh(entry.site, sysop)
+ refresh(entry.site)
seen.add(entry.site)


-def refresh_new(sysop=False):
+def refresh_new():
"""Load watchlists of all wikis for accounts set in user-config.py."""
pywikibot.output(
'Downloading all watchlists for your accounts in user-config.py')
for family in config.usernames:
for lang in config.usernames[family]:
site = pywikibot.Site(lang, family)
- refresh(site, sysop=sysop)
- for family in config.sysopnames:
- for lang in config.sysopnames[family]:
- site = pywikibot.Site(lang, family)
- refresh(site, sysop=sysop)
+ refresh(site)


def main(*args):
@@ -93,23 +86,20 @@
@param args: command line arguments
@type args: str
"""
- all = False
- new = False
- sysop = False
+ opt_all = False
+ opt_new = False
for arg in pywikibot.handle_args(args):
if arg in ('-all', '-update'):
- all = True
+ opt_all = True
elif arg == '-new':
- new = True
- elif arg == '-sysop':
- sysop = True
- if all:
- refresh_all(sysop=sysop)
- elif new:
- refresh_new(sysop=sysop)
+ opt_new = True
+ if opt_all:
+ refresh_all()
+ elif opt_new:
+ refresh_new()
else:
site = pywikibot.Site()
- watchlist = refresh(site, sysop=sysop)
+ watchlist = refresh(site)
pywikibot.output('{} pages in the watchlist.'.format(len(watchlist)))
for page in watchlist:
try:

To view, visit change 563973. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Idd35db2937629247351f45a3e26a4f0b09d59248
Gerrit-Change-Number: 563973
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Huji <huji.huji@gmail.com>
Gerrit-Reviewer: jenkins-bot (75)