Skip to content

Commit 90355b3

Browse files
committed
Move entry point parsing to EntryPoints class.
1 parent 60fb233 commit 90355b3

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

importlib_metadata/__init__.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -172,18 +172,6 @@ def extras(self):
172172
match = self.pattern.match(self.value)
173173
return list(re.finditer(r'\w+', match.group('extras') or ''))
174174

175-
@classmethod
176-
def _from_text(cls, text):
177-
return itertools.starmap(cls, cls._parse_groups(text or ''))
178-
179-
@staticmethod
180-
def _parse_groups(text):
181-
return (
182-
(name, value, section)
183-
for section, values in Sectioned.get_sections(text)
184-
for name, value in values
185-
)
186-
187175
def _for(self, dist):
188176
self.dist = dist
189177
return self
@@ -253,7 +241,19 @@ def groups(self):
253241

254242
@classmethod
255243
def _from_text_for(cls, text, dist):
256-
return cls(ep._for(dist) for ep in EntryPoint._from_text(text))
244+
return cls(ep._for(dist) for ep in cls._from_text(text))
245+
246+
@classmethod
247+
def _from_text(cls, text):
248+
return itertools.starmap(EntryPoint, cls._parse_groups(text or ''))
249+
250+
@staticmethod
251+
def _parse_groups(text):
252+
return (
253+
(name, value, section)
254+
for section, values in Sectioned.get_sections(text)
255+
for name, value in values
256+
)
257257

258258

259259
def flake8_bypass(func):

0 commit comments

Comments
 (0)