Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: add optional arguments to deprecated, and deprecate Ddict #1613

Merged
merged 2 commits into from
Jul 24, 2019

Conversation

Exirel
Copy link
Contributor

@Exirel Exirel commented May 18, 2019

So, at first, I was going to deprecate the Ddict class, which can be replaced by collections.defaultdict since Python 2.5. I suspect it was very useful when the bot had to support Python version such as 2.2 or 2.4 (which used to be quite popular for a long time).

However, I could not get the proper deprecation warning: decorating the __init__ method didn't give me what I wanted.

So I decided to allow this usage of the @deprecated decorator:

@deprecated  # as it is now
@deprecated()  # because why not
@deprecated(reason='obsolete')  # chose your message
@deprecated(version='7.0', removed_in='8.0')  # deprecated in 7, removed in 8
@deprecated(reason='obsolete', version='7.0') # deprecated in 7, no "removed in" yet
@deprecated(reason='obsolete', version='7.0', removed_in='8.0')  # everything

So now, Ddict is deprecated, and we have a better decorator!

@Exirel Exirel added this to the 7.0.0 milestone May 18, 2019
@Exirel Exirel requested a review from dgw May 18, 2019 17:37
@Exirel Exirel changed the title tools: add optional argument to deprecated, and deprecate Ddict tools: add optional arguments to deprecated, and deprecate Ddict May 18, 2019
@dgw
Copy link
Member

dgw commented Jun 30, 2019

I like this, but it has merge conflicts with meetbot now. :/

What I don't like are the comma splices in the messages @deprecated actually prints, but I can't think of a nice way to eliminate them at the moment.

@Exirel Exirel force-pushed the ddict-deprecated branch from b88925c to 84a2842 Compare July 2, 2019 18:39
@Exirel
Copy link
Contributor Author

Exirel commented Jul 2, 2019

It doesn't anymore!

Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'mma mark this as ready 👍

@dgw dgw merged commit 8de2b6a into sopel-irc:master Jul 24, 2019
@Exirel Exirel deleted the ddict-deprecated branch September 5, 2019 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants