jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/970406 )
Change subject: [typing] Fix some typing hints ......................................................................
[typing] Fix some typing hints
Change-Id: Ia65f034e444814375c3f88b0ac0585575b080aeb --- M pywikibot/family.py M pywikibot/logging.py M pywikibot/proofreadpage.py 3 files changed, 14 insertions(+), 3 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/family.py b/pywikibot/family.py index 8aea007..2e0a100 100644 --- a/pywikibot/family.py +++ b/pywikibot/family.py @@ -666,6 +666,7 @@ return hash(self.name)
def __str__(self) -> str: + assert isinstance(self.name, str) return self.name
def __repr__(self) -> str: diff --git a/pywikibot/logging.py b/pywikibot/logging.py index f87bf92..d81d7f6 100644 --- a/pywikibot/logging.py +++ b/pywikibot/logging.py @@ -32,7 +32,7 @@ from logging import CRITICAL, DEBUG, ERROR, INFO, WARNING from typing import Any
-from pywikibot.backports import Callable, List +from pywikibot.backports import Callable, List, Tuple from pywikibot.tools import deprecated_args, issue_deprecation_warning
@@ -107,6 +107,7 @@ if _init_routines: _init()
+ keys: Tuple[str, ...] # cleanup positional args if level == ERROR: keys = ('decoder', 'newline', 'exc_info') @@ -114,6 +115,7 @@ keys = ('layer', 'decoder', 'newline') else: keys = ('decoder', 'newline') + for i, arg in enumerate(args): key = keys[i] issue_deprecation_warning( diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py index 8432fc5..e72b676 100644 --- a/pywikibot/proofreadpage.py +++ b/pywikibot/proofreadpage.py @@ -290,8 +290,7 @@ 'tosection', 'onlysection', ) - tokens = '(' + '=|'.join(tokens) + '=)' - pat_attr = re.compile(tokens) + pat_attr = re.compile(f"({'=|'.join(tokens)}=)")
index = TagAttrDesc() ffrom = TagAttrDesc()
pywikibot-commits@lists.wikimedia.org