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: deprecate more Python 2-like shims #2228

Merged
merged 2 commits into from
Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ sopel.tools

.. automodule:: sopel.tools
:members:
:exclude-members: iteritems, iterkeys, itervalues, raw_input
:private-members: Identifier._lower, Identifier._lower_swapped

sopel.tools.web
Expand Down
30 changes: 23 additions & 7 deletions sopel/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@
from ._events import events # NOQA


# Kept for backward compatibility
# TODO: consider removing that
raw_input = input
iteritems = dict.items
itervalues = dict.values
iterkeys = dict.keys

_channel_prefixes = ('#', '&', '+', '!')

# Can be implementation-dependent
Expand Down Expand Up @@ -205,6 +198,29 @@ def deprecated_func(*args, **kwargs):
from . import time, web # NOQA


# Long kept for Python compatibility, but it's time we let these go.
raw_input = deprecated( # pragma: no cover
'Use the `input` function directly.',
version='8.0',
removed_in='8.1',
func=input)
iteritems = deprecated( # pragma: no cover
"Use the dict object's `.items()` method directly.",
version='8.0',
removed_in='8.1',
func=dict.items)
itervalues = deprecated( # pragma: no cover
"Use the dict object's `.values()` method directly.",
version='8.0',
removed_in='8.1',
func=dict.values)
iterkeys = deprecated( # pragma: no cover
"Use the dict object's `.keys()` method directly.",
version='8.0',
removed_in='8.1',
func=dict.keys)


@deprecated('Shim for Python 2 cross-compatibility, no longer needed. '
'Use built-in `input()` instead.',
version='7.1',
Expand Down