jenkins-bot submitted this change.

View Change


Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[doc] Publish textlib._get_regexes()

Bug: T336144
Change-Id: I9ecd54004a2d1a9ba86cab0b4a48980f9a2c207b
---
M pywikibot/textlib.py
1 file changed, 18 insertions(+), 4 deletions(-)

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]

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I9ecd54004a2d1a9ba86cab0b4a48980f9a2c207b
Gerrit-Change-Number: 917892
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged