diff --git a/scripts/run-pyright.py b/scripts/run-pyright.py index 45585336f5edb..3098962f22d9d 100755 --- a/scripts/run-pyright.py +++ b/scripts/run-pyright.py @@ -260,17 +260,15 @@ def map_paths_to_envs(paths: Sequence[str]) -> Mapping[str, Sequence[str]]: env_path_map: Dict[str, List[str]] = {} for path in paths: if os.path.isdir(path) or os.path.splitext(path)[1] in [".py", ".pyi"]: - try: - env = next( - ( - env_path_spec["env"] - for env_path_spec in env_path_specs - if match_path(path, env_path_spec) - ) - ) - except StopIteration: + print(f"Trying to match path: {path}") # Debug print + for env_path_spec in env_path_specs: + print(f" Checking env: {env_path_spec['env']}") # Debug print + if match_path(path, env_path_spec): + print(" Matched!") # Debug print + env_path_map.setdefault(env_path_spec["env"], []).append(path) + break + else: raise Exception(f"Could not find environment that matched path: {path}.") - env_path_map.setdefault(env, []).append(path) return env_path_map