Skip to content

Commit fea6e75

Browse files
committed
Move is_egg into prepared.
1 parent 313535a commit fea6e75

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

importlib_metadata/__init__.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -462,18 +462,11 @@ def zip_children(self):
462462
for child in names
463463
)
464464

465-
def is_egg(self, search):
466-
base = self.base
467-
return (
468-
base == search.versionless_egg_name
469-
or base.startswith(search.prefix)
470-
and base.endswith('.egg'))
471-
472465
def search(self, name):
473466
return (
474467
self.joinpath(child)
475468
for child in self.children()
476-
if name.matches(child, self)
469+
if name.matches(child, self.base)
477470
)
478471

479472

@@ -504,16 +497,22 @@ def normalize(name):
504497
"""
505498
return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
506499

507-
def matches(self, name, path):
500+
def matches(self, name, base):
508501
n_low = name.lower()
509502
return (
510503
n_low in self.exact_matches
511504
or n_low.replace('.', '_').startswith(self.prefix)
512505
and n_low.endswith(self.suffixes)
513506
# legacy case:
514-
or path.is_egg(self) and n_low == 'egg-info'
507+
or self.is_egg(base) and n_low == 'egg-info'
515508
)
516509

510+
def is_egg(self, base):
511+
return (
512+
base == self.versionless_egg_name
513+
or base.startswith(self.prefix)
514+
and base.endswith('.egg'))
515+
517516

518517
@install
519518
class MetadataPathFinder(NullFinder, DistributionFinder):

0 commit comments

Comments
 (0)