Skip to content

Commit 066e24d

Browse files
committed
With commit 0c81964 the behavior of Entrypoints gets a bit disorienting.
Change __repr__ to reflect that Entrpoints is are longer indexable by integers like tuples, but signal our custom behavior.
1 parent 353c3df commit 066e24d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

importlib_metadata/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,14 @@ def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override]
293293
except StopIteration:
294294
raise KeyError(name)
295295

296+
def __repr__(self):
297+
"""
298+
Repr with classname and tuple constructor to
299+
signal that we deviate from regular tuple behavior.
300+
"""
301+
return '%s(%r)' % (self.__class__.__name__, tuple(self))
302+
303+
296304
def select(self, **params):
297305
"""
298306
Select entry points from self that match the

0 commit comments

Comments
 (0)