jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1339201?usp=email )
Change subject: tools: Use dict for deprecated parameters
......................................................................
tools: Use dict for deprecated parameters
Python preserves dictionary insertion order, so signature parameter
construction no longer needs OrderedDict. Use regular dictionaries and
remove the unused collections import.
Change-Id: I69acb4e6169028beb9deecab2ed7f3fe65b6205a
---
M pywikibot/tools/_deprecate.py
1 file changed, 2 insertions(+), 4 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/tools/_deprecate.py b/pywikibot/tools/_deprecate.py
index e9a0c71..751ba37 100644
--- a/pywikibot/tools/_deprecate.py
+++ b/pywikibot/tools/_deprecate.py
@@ -25,7 +25,6 @@
"""
from __future__ import annotations
-import collections
import inspect
import re
import sys
@@ -433,7 +432,7 @@
if wrapper.__signature__:
# Build a new signature with deprecated args added.
- params = collections.OrderedDict()
+ params = {}
for param in wrapper.__signature__.parameters.values():
params[param.name] = param.replace()
for old_arg, new_arg in arg_pairs.items():
@@ -442,8 +441,7 @@
default=f'[deprecated name of {new_arg}]'
if new_arg not in [True, False, None, '']
else NotImplemented)
- params = collections.OrderedDict(sorted(params.items(),
- key=lambda x: x[1].kind))
+ params = dict(sorted(params.items(), key=lambda x: x[1].kind))
wrapper.__signature__ = inspect.Signature()
wrapper.__signature__._parameters = params
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1339201?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I69acb4e6169028beb9deecab2ed7f3fe65b6205a
Gerrit-Change-Number: 1339201
Gerrit-PatchSet: 1
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]