Skip to content

Commit

Permalink
With commit 0c81964 the behavior of Entrypoints gets a bit disorienting.
Browse files Browse the repository at this point in the history
Change __repr__ to reflect that Entrpoints is are longer indexable by integers like tuples, but signal our custom behavior.
  • Loading branch information
amundhov committed Oct 11, 2023
1 parent 353c3df commit 066e24d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,14 @@ def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override]
except StopIteration:
raise KeyError(name)

def __repr__(self):
"""
Repr with classname and tuple constructor to
signal that we deviate from regular tuple behavior.
"""
return '%s(%r)' % (self.__class__.__name__, tuple(self))


def select(self, **params):
"""
Select entry points from self that match the
Expand Down

0 comments on commit 066e24d

Please sign in to comment.