jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[cleanup] Deprecate DotReadableDict

DotReadableDict only defines itself as "Parent class of Revision() and
FileInfo()" rather than providing anything useful. Revision no longer uses it,
and DotReadableDict is a pretty trivial class so merging what it has into
FileInfo.

Change-Id: I96eb5476e12c2afe8cceeb97419ffef5426ad3ab
---
M pywikibot/page/__init__.py
M pywikibot/tools/__init__.py
2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index a5aa643..2a6ba98 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -58,7 +58,6 @@
deprecated,
deprecate_arg,
deprecated_args,
- DotReadableDict,
first_upper,
redirect_func,
remove_last_args,
@@ -4873,7 +4872,7 @@
}


-class FileInfo(DotReadableDict):
+class FileInfo:

"""
A structure holding imageinfo of latest rev. of FilePage.
@@ -4895,6 +4894,14 @@
self.__dict__.update(file_revision)
self.timestamp = pywikibot.Timestamp.fromISOformat(self.timestamp)

+ def __getitem__(self, key):
+ """Give access to class values by key."""
+ return getattr(self, key)
+
+ def __repr__(self):
+ """Return a more complete string representation."""
+ return repr(self.__dict__)
+
def __eq__(self, other):
"""Test if two File_info objects are equal."""
return self.__dict__ == other.__dict__
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index f891c09..ac1ce9b 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -1900,3 +1900,8 @@
option_msg += '\n' + ' ' * indent
option_msg += option_line
return '{} ({}):'.format(message, option_msg)
+
+
+wrapper = ModuleDeprecationWrapper(__name__)
+wrapper._add_deprecated_attr('DotReadableDict', replacement_name='',
+ since='20210416', future_warning=True)

To view, visit change 680030. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I96eb5476e12c2afe8cceeb97419ffef5426ad3ab
Gerrit-Change-Number: 680030
Gerrit-PatchSet: 3
Gerrit-Owner: Damian <atagar1@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged