Skip to content

Commit 077b1d0

Browse files
Update src/validate_pyproject/plugins/__init__.py
Co-authored-by: Anderson Bravalheri <andersonbravalheri+github@gmail.com>
1 parent a19460e commit 077b1d0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/validate_pyproject/plugins/__init__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,18 @@ def list_from_entry_points(
160160
loaded and included (or not) in the final list. A ``True`` return means the
161161
plugin should be included.
162162
"""
163-
eps: List[Union[PluginWrapper, StoredPlugin]] = [
163+
tool_eps = (
164164
load_from_entry_point(e)
165165
for e in iterate_entry_points("validate_pyproject.tool_schema")
166166
if filtering(e)
167-
]
168-
for e in iterate_entry_points("validate_pyproject.multi_schema"):
169-
eps.extend(load_from_multi_entry_point(e))
170-
dedup = {(e.tool if e.tool else e.id): e for e in sorted(eps, key=lambda e: e.tool)}
167+
)
168+
multi_eps = (
169+
load_from_multi_entry_point(e)
170+
for e in iterate_entry_points("validate_pyproject.multi_schema")
171+
if filtering(e)
172+
)
173+
eps = chain(tool_eps, chain.from_iterable(multi_eps))
174+
dedup = {(e.tool or e.id): e for e in sorted(eps, key=lambda e: e.tool or e.id)}
171175
return list(dedup.values())
172176

173177

0 commit comments

Comments
 (0)