3
3
from pathlib import Path
4
4
from typing import AbstractSet , Dict , Iterator , Optional , Set , Type
5
5
6
- from fawltydeps .extract_declared_dependencies import is_valid_deps_source
7
- from fawltydeps .extract_imports import is_valid_code_source
6
+ from fawltydeps .extract_declared_dependencies import validate_deps_source
7
+ from fawltydeps .extract_imports import validate_code_source
8
8
from fawltydeps .settings import Settings
9
9
from fawltydeps .types import CodeSource , DepsSource , Source , UnparseablePathException
10
10
from fawltydeps .utils import walk_dir
@@ -26,7 +26,7 @@ def find_sources(
26
26
dirs_to_traverse : Dict [Path , Set [Type [Source ]]] = {}
27
27
28
28
for path in settings .code if CodeSource in source_types else []:
29
- validated : Optional [Source ] = is_valid_code_source (path ) # propagate exceptions
29
+ validated : Optional [Source ] = validate_code_source (path ) # propagate exceptions
30
30
if validated is not None : # parse-able file given directly
31
31
assert isinstance (validated , CodeSource ) # sanity check
32
32
yield validated
@@ -35,7 +35,7 @@ def find_sources(
35
35
dirs_to_traverse .setdefault (path , set ()).add (CodeSource )
36
36
37
37
for path in settings .deps if DepsSource in source_types else []:
38
- validated = is_valid_deps_source (
38
+ validated = validate_deps_source (
39
39
path , settings .deps_parser_choice , filter_by_parser = False
40
40
) # propagate exceptions
41
41
if validated is not None : # parse-able file given directly
@@ -49,14 +49,14 @@ def find_sources(
49
49
for file in walk_dir (dir_path ): # traverse directories only _once_
50
50
if CodeSource in types :
51
51
try : # catch all exceptions while traversing dirs
52
- validated = is_valid_code_source (file , dir_path )
52
+ validated = validate_code_source (file , dir_path )
53
53
assert isinstance (validated , CodeSource ) # sanity check
54
54
yield validated
55
55
except UnparseablePathException : # don't abort directory walk for this
56
56
pass
57
57
if DepsSource in types :
58
58
try : # catch all exceptions while traversing dirs
59
- validated = is_valid_deps_source (
59
+ validated = validate_deps_source (
60
60
file , settings .deps_parser_choice , filter_by_parser = True
61
61
)
62
62
assert isinstance (validated , DepsSource ) # sanity check
0 commit comments