Skip to content

Commit d983ef3

Browse files
committed
switch order of impl and stub pattern checks
1 parent 5bd6543 commit d983ef3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/python/pants/backend/python/dependency_inference/module_mapper.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,11 @@ def add_modules(modules: Iterable[str], *, is_type_stub: bool) -> None:
384384
elif proj_name in DEFAULT_TYPE_STUB_MODULE_MAPPING:
385385
modules_to_add = DEFAULT_TYPE_STUB_MODULE_MAPPING[proj_name]
386386
is_type_stub = True
387-
elif modules_to_add := generate_mappings_from_pattern(proj_name, is_type_stub=False):
388-
is_type_stub = False
387+
# check for stubs first, since stub packages may also match impl package patterns
389388
elif modules_to_add := generate_mappings_from_pattern(proj_name, is_type_stub=True):
390389
is_type_stub = True
390+
elif modules_to_add := generate_mappings_from_pattern(proj_name, is_type_stub=False):
391+
is_type_stub = False
391392
else:
392393
modules_to_add = (fallback_value,)
393394
is_type_stub = False

0 commit comments

Comments
 (0)