Skip to content

Commit

Permalink
Removed EntryPoint access by numeric index (tuple behavior).
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 3, 2023
1 parent 84418f8 commit 37113c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 29 deletions.
30 changes: 1 addition & 29 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
NullFinder,
StrPath,
install,
pypy_partial,
)
from ._functools import method_cache, pass_none
from ._itertools import always_iterable, unique_everseen
Expand Down Expand Up @@ -128,34 +127,7 @@ def valid(line: str):
return line and not line.startswith('#')


class DeprecatedTuple:
"""
Provide subscript item access for backward compatibility.
>>> recwarn = getfixture('recwarn')
>>> ep = EntryPoint(name='name', value='value', group='group')
>>> ep[:]
('name', 'value', 'group')
>>> ep[0]
'name'
>>> len(recwarn)
1
"""

# Do not remove prior to 2023-05-01 or Python 3.13
_warn = functools.partial(
warnings.warn,
"EntryPoint tuple interface is deprecated. Access members by name.",
DeprecationWarning,
stacklevel=pypy_partial(2),
)

def __getitem__(self, item):
self._warn()
return self._key()[item]


class EntryPoint(DeprecatedTuple):
class EntryPoint:
"""An entry point as defined by Python packaging conventions.
See `the packaging docs on entry points
Expand Down
1 change: 1 addition & 0 deletions newsfragments/+9c754ffa.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed EntryPoint access by numeric index (tuple behavior).

0 comments on commit 37113c2

Please sign in to comment.