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

Remove SelectableGroups deprecation exception for flake8. #319

Merged
merged 5 commits into from Jun 3, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.rst
@@ -1,3 +1,9 @@
v4.5.0
=======

* #319: Remove ``SelectableGroups`` deprecation exception
for flake8.

v4.4.0
=======

Expand Down
10 changes: 1 addition & 9 deletions importlib_metadata/__init__.py
Expand Up @@ -367,14 +367,6 @@ def _parse_groups(text):
)


def flake8_bypass(func):
# defer inspect import as performance optimization.
import inspect

is_flake8 = any('flake8' in str(frame.filename) for frame in inspect.stack()[:5])
return func if not is_flake8 else lambda: None


class Deprecated:
"""
Compatibility add-in for mapping to indicate that
Expand Down Expand Up @@ -410,7 +402,7 @@ def __getitem__(self, name):
return super().__getitem__(name)

def get(self, name, default=None):
flake8_bypass(self._warn)()
self._warn()
return super().get(name, default)

def __iter__(self):
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Expand Up @@ -5,3 +5,5 @@ doctest_optionflags=ALLOW_UNICODE ELLIPSIS
# workaround for warning pytest-dev/pytest#6178
junit_family=xunit2
filterwarnings=
# Suppress deprecation warning in flake8
ignore:SelectableGroups dict interface is deprecated::flake8