jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/917892 )
Change subject: [doc] Publish textlib._get_regexes() ......................................................................
[doc] Publish textlib._get_regexes()
Bug: T336144 Change-Id: I9ecd54004a2d1a9ba86cab0b4a48980f9a2c207b --- M pywikibot/textlib.py 1 file changed, 18 insertions(+), 4 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index 2cb5d38..047628b 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -18,6 +18,7 @@ import pywikibot from pywikibot.backports import Container, Dict, Iterable, List from pywikibot.backports import OrderedDict as OrderedDictType +from pywikibot.backports import Pattern from pywikibot.backports import Sequence as SequenceType from pywikibot.backports import Tuple from pywikibot.exceptions import InvalidTitleError, SiteDefinitionError @@ -300,8 +301,11 @@ })
-def _get_regexes(keys, site): - """Fetch compiled regexes.""" +def _get_regexes(keys: Iterable, site) -> List[Pattern[str]]: + """Fetch compiled regexes. + + :meta public: + """ if not _regex_cache: _create_default_regexes()
@@ -319,8 +323,8 @@ if isinstance(_regex_cache[exc], tuple): if not site and exc in ('interwiki', 'property', 'invoke', 'category', 'file'): - raise ValueError("Site cannot be None for the '{}' regex" - .format(exc)) + raise ValueError( + 'Site cannot be None for the {exc!r} regex')
if (exc, site) not in _regex_cache: re_text, re_var = _regex_cache[exc]