Skip to content

Commit 9448e13

Browse files
committed
Make entry point collections (more) immutable.
1 parent 342a94b commit 9448e13

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

importlib_metadata/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,11 @@ def __reduce__(self):
157157

158158
class EntryPoints(tuple):
159159
"""
160-
A collection of EntryPoint objects, retrievable by name.
160+
An immutable collection of EntryPoint objects, retrievable by name.
161161
"""
162162

163+
__slots__ = ()
164+
163165
def __getitem__(self, name) -> EntryPoint:
164166
try:
165167
return next(ep for ep in self if ep.name == name)
@@ -173,9 +175,11 @@ def names(self):
173175

174176
class GroupedEntryPoints(tuple):
175177
"""
176-
A collection of EntryPoint objects, retrievable by group.
178+
An immutable collection of EntryPoint objects, retrievable by group.
177179
"""
178180

181+
__slots__ = ()
182+
179183
def __getitem__(self, group) -> EntryPoints:
180184
return EntryPoints(ep for ep in self if ep.group == group)
181185

0 commit comments

Comments
 (0)