jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1309904?usp=email )
Change subject: mypy: Fiy some typing issures in date.py ......................................................................
mypy: Fiy some typing issures in date.py
Change-Id: Ie2c7123f52740f783e8a43fa8982a01432a9896d --- M pywikibot/date.py 1 file changed, 5 insertions(+), 4 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/pywikibot/date.py b/pywikibot/date.py index 8264395..9a2a028 100644 --- a/pywikibot/date.py +++ b/pywikibot/date.py @@ -62,7 +62,7 @@
@singledispatch -def multi(value, tuplst: tuplst_type) -> Any: +def multi(value: int | str, tuplst: tuplst_type) -> Any: """Run multiple pattern checks for the same entry.
For example: 1st century, 2nd century, etc. @@ -78,7 +78,7 @@
@multi.register(int) -def _(value: int, tuplst: tuplst_type) -> Any: +def _(value: int, tuplst: tuplst_type) -> str: # Find a predicate that gives true for this int value, and run a # function for func, pred in tuplst: @@ -88,7 +88,7 @@
@multi.register(str) -def _(value: str, tuplst: tuplst_type) -> Any: +def _(value: str, tuplst: tuplst_type) -> int: # Try all functions, and test result against predicates for func, pred in tuplst: try: @@ -394,7 +394,7 @@ _reParameters = re.compile('|'.join(f'(%[1-9]?{s})' for s in _digitDecoders))
# A map of sitecode+pattern to (re matching object and corresponding decoders) -_escPtrnCache2 = {} +_escPtrnCache2: dict[str, tuple[re.Pattern[str], str, list[decoder_type]]] = {}
def escapePattern2( @@ -680,6 +680,7 @@ else: raise KeyError(f"Wrong variant '{self.variant}'")
+ f: Callable[[str], str] if ucase: f = first_upper elif ucase is False:
pywikibot-commits@lists.wikimedia.org