Skip to content

Commit

Permalink
Leverage EntryPoints interfaces in SelectableGroups
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Feb 23, 2021
1 parent 2def046 commit dd8da47
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions importlib_metadata/__init__.py
Expand Up @@ -205,9 +205,13 @@ def load(cls, eps):
grouped = itertools.groupby(ordered, by_group)
return cls((group, EntryPoints(eps)) for group, eps in grouped)

@property
def _all(self):
return EntryPoints(itertools.chain.from_iterable(self.values()))

@property
def groups(self):
return set(self.keys())
return self._all.groups

@property
def names(self):
Expand All @@ -216,16 +220,12 @@ def names(self):
>>> SelectableGroups().names
set()
"""
return set(ep.name for ep in self._all)

@property
def _all(self):
return itertools.chain.from_iterable(self.values())
return self._all.names

def select(self, **params):
if not params:
return self
return EntryPoints(self._all).select(**params)
return self._all.select(**params)


class LegacyGroupedEntryPoints(EntryPoints): # pragma: nocover
Expand Down

0 comments on commit dd8da47

Please sign in to comment.