Skip to content

Commit 401c041

Browse files
committed
Move selectable groups after DeprecatedDict
1 parent 1f2a89c commit 401c041

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

importlib_metadata/__init__.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -193,42 +193,6 @@ def _from_text_for(cls, text, dist):
193193
return cls(ep._for(dist) for ep in EntryPoint._from_text(text))
194194

195195

196-
class SelectableGroups(dict):
197-
"""
198-
A backward- and forward-compatible result from
199-
entry_points that fully implements the dict interface.
200-
"""
201-
202-
@classmethod
203-
def load(cls, eps):
204-
by_group = operator.attrgetter('group')
205-
ordered = sorted(eps, key=by_group)
206-
grouped = itertools.groupby(ordered, by_group)
207-
return cls((group, EntryPoints(eps)) for group, eps in grouped)
208-
209-
@property
210-
def _all(self):
211-
return EntryPoints(itertools.chain.from_iterable(self.values()))
212-
213-
@property
214-
def groups(self):
215-
return self._all.groups
216-
217-
@property
218-
def names(self):
219-
"""
220-
for coverage:
221-
>>> SelectableGroups().names
222-
set()
223-
"""
224-
return self._all.names
225-
226-
def select(self, **params):
227-
if not params:
228-
return self
229-
return self._all.select(**params)
230-
231-
232196
class Flake8Bypass(warnings.catch_warnings, contextlib.ContextDecorator):
233197
def __enter__(self):
234198
super().__enter__()
@@ -291,6 +255,42 @@ def values(self):
291255
return super().values()
292256

293257

258+
class SelectableGroups(dict):
259+
"""
260+
A backward- and forward-compatible result from
261+
entry_points that fully implements the dict interface.
262+
"""
263+
264+
@classmethod
265+
def load(cls, eps):
266+
by_group = operator.attrgetter('group')
267+
ordered = sorted(eps, key=by_group)
268+
grouped = itertools.groupby(ordered, by_group)
269+
return cls((group, EntryPoints(eps)) for group, eps in grouped)
270+
271+
@property
272+
def _all(self):
273+
return EntryPoints(itertools.chain.from_iterable(self.values()))
274+
275+
@property
276+
def groups(self):
277+
return self._all.groups
278+
279+
@property
280+
def names(self):
281+
"""
282+
for coverage:
283+
>>> SelectableGroups().names
284+
set()
285+
"""
286+
return self._all.names
287+
288+
def select(self, **params):
289+
if not params:
290+
return self
291+
return self._all.select(**params)
292+
293+
294294
class PackagePath(pathlib.PurePosixPath):
295295
"""A reference to a path in a package"""
296296

0 commit comments

Comments
 (0)