102 modules_found = any(module.endswith('watchlistraw')
103 for module in modules)
104 # for list API usage 'watchlistraw' is directly found
105 if modules_found or 'watchlistraw' in entry._data:106 executor.submit(refresh, entry.site)
107 seen.add(entry.site)
108
98 continue
99
100 # for generator API usage we have to check the modules
101 modules = entry._params.get('modules', [])102 modules_found = any(module.endswith('watchlistraw')
103 for module in modules)
104 # for list API usage 'watchlistraw' is directly found
93 entry = CacheEntry(cache_path, filename)
94 entry._load_cache()
95 entry.parse_key()
96 entry._rebuild() 97 if entry.site in seen:
98 continue
99
91 with ThreadPoolExecutor() as executor:
92 for filename in files:
93 entry = CacheEntry(cache_path, filename)
94 entry._load_cache() 95 entry.parse_key()
96 entry._rebuild()
97 if entry.site in seen:
85
86def refresh_all() -> None:
87 """Reload watchlists for all wikis where a watchlist is already present."""
88 cache_path = CachedRequest._get_cache_dir() 89 files = os.scandir(cache_path)
90 seen = set()
91 with ThreadPoolExecutor() as executor:
Accessing a protected member (a member prefixed with _
) of a class from outside that class is not recommended, since the creator of that class did not intend this member to be exposed. If accesing this attribute outside of the class is absolutely needed, refactor it such that it becomes part of the public interface of the class.
class Rectangle(object):
def __init__(self, height, width):
self._height = height
self._width = width
r = Rectangle(4, 8)
area = r._height * r._width
class Rectangle(object):
def __init__(self, height, width):
self._height = height
self._width = width
def area():
return self._height * self._width
r = Rectangle(4, 8)
area = r.area()