Skip to content

Commit 63c4a77

Browse files
committed
Remove cached property and disallow_dist.
1 parent 8ba08e3 commit 63c4a77

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

Lib/importlib/metadata/__init__.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def attr(self) -> str:
229229
def extras(self) -> list[str]:
230230
return re.findall(r'\w+', self._match.extras or '')
231231

232-
@functools.cached_property
232+
@property
233233
def _match(self) -> _EntryPointMatch:
234234
match = self.pattern.match(self.value)
235235
if not match:
@@ -265,26 +265,9 @@ def matches(self, **params):
265265
>>> ep.matches(attr='bong')
266266
True
267267
"""
268-
self._disallow_dist(params)
269268
attrs = (getattr(self, param) for param in params)
270269
return all(map(operator.eq, params.values(), attrs))
271270

272-
@staticmethod
273-
def _disallow_dist(params):
274-
"""
275-
Querying by dist is not allowed (dist objects are not comparable).
276-
>>> EntryPoint(name='fan', value='fav', group='fag').matches(dist='foo')
277-
Traceback (most recent call last):
278-
...
279-
ValueError: "dist" is not suitable for matching...
280-
"""
281-
if "dist" in params:
282-
raise ValueError(
283-
'"dist" is not suitable for matching. '
284-
"Instead, use Distribution.entry_points.select() on a "
285-
"located distribution."
286-
)
287-
288271
def _key(self):
289272
return self.name, self.value, self.group
290273

0 commit comments

Comments
 (0)