Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

Commit 68c2772

Browse files
John Andersenpdxjohnny
authored andcommitted
util: entrypoint: Speed up named loads
Signed-off-by: John Andersen <[email protected]>
1 parent ac13056 commit 68c2772

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
property is a class which has been decorated with dffml.base.config to make it
1818
a dataclass.
1919
- Speed up development service install of all plugins in development mode
20+
- Speed up named plugin load times
2021
### Fixed
2122
- DataFlows with multiple possibilities for a source for an input, now correctly
2223
look through all possible sources instead of just the first one.

dffml/util/entrypoint.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ def load(cls, loading=None):
135135
loaded_names = []
136136
loading_classes = []
137137
for i in pkg_resources.iter_entry_points(cls.ENTRY_POINT):
138+
loaded_names.append(i.name)
139+
if loading is not None and i.name != loading:
140+
continue
138141
try:
139142
loaded = i.load()
140143
except Exception as error:
@@ -146,7 +149,6 @@ def load(cls, loading=None):
146149
raise
147150
loaded.ENTRY_POINT_LABEL = i.name
148151
if issubclass(loaded, cls):
149-
loaded_names.append(i.name)
150152
loading_classes.append(loaded)
151153
if loading is not None and i.name == loading:
152154
return loaded

0 commit comments

Comments
 (0)