jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/635997 )
Change subject: [4.0] Remove Python 2 workarounds in family.py
......................................................................
[4.0] Remove Python 2 workarounds in family.py
Changes proposed by zhuyifei1999
Bug: T265817
Change-Id: Idfe7fd5262cd16da92253e0550b1c508bb1480a8
---
M pywikibot/family.py
1 file changed, 3 insertions(+), 6 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/family.py b/pywikibot/family.py
index b25c9cb..aff0db5 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -45,21 +45,18 @@
# any Family class defined in this file are abstract
if cls in globals().values():
raise TypeError(
- 'Abstract Family class {0} cannot be instantiated; '
+ 'Abstract Family class {} cannot be instantiated; '
'subclass it instead'.format(cls.__name__))
# Override classproperty
cls.instance = super().__new__(cls)
- # staticmethod is because python 2.7 binds the lambda to the class
- cls.__new__ = staticmethod(lambda cls: cls.instance) # shortcut
+ cls.__new__ = lambda cls: cls.instance # shortcut
# don't use hasattr() here. consider only the class itself
if '__init__' in cls.__dict__:
# Initializer deprecated. Families should be immutable and any
# instance / class modification should go to allocator (__new__).
- # The function is read from __dict__ because deprecated expect a
- # function and python 2.7 binds the method to the class.
- cls.__init__ = deprecated(cls.__dict__['__init__'])
+ cls.__init__ = deprecated(cls.__init__)
# Invoke initializer immediately and make initializer no-op.
# This is to avoid repeated initializer invocation on repeated
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/635997
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: Idfe7fd5262cd16da92253e0550b1c508bb1480a8
Gerrit-Change-Number: 635997
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged