jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1001357?usp=email )
Change subject: [cleanup] use type annotation for singledispatch
......................................................................
[cleanup] use type annotation for singledispatch
The register() attribute supports using type annotations with Python 3.7.
Ignore it for some function, otherwise Union, Tuple, and List must be
imported from typing.
Bug: T347026
Change-Id: I543098278eeb9c4af187b17a4f18dfb12056a78b
---
M pywikibot/date.py
1 file changed, 17 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/date.py b/pywikibot/date.py
index 4a85afc..09d7caf 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -240,7 +240,7 @@
return lst[value - 1]
-(a)slh.register(str)
+(a)slh.register
def _(value: str, lst: Sequence[str]) -> int:
return lst.index(value) + 1
@@ -251,7 +251,7 @@
return dh_constVal(value, 0, match)
-(a)dh_singVal.register(str)
+(a)dh_singVal.register
def _(value: str, match: str) -> int:
return dh_constVal(value, 0, match) # type: ignore[return-value]
@@ -268,7 +268,7 @@
raise ValueError(f'unknown value {value}')
-(a)dh_constVal.register(str)
+(a)dh_constVal.register
def _(value: str, ind: int, match: str) -> int:
if value == match:
return ind
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1001357?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I543098278eeb9c4af187b17a4f18dfb12056a78b
Gerrit-Change-Number: 1001357
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged