Skip to content

Commit 3346cdf

Browse files
jherlandmknorps
andcommitted
Rename is_valid_*_source() to validate_*_source()
Co-authored-by: Maria Knorps <[email protected]>
1 parent 5a774bc commit 3346cdf

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

fawltydeps/extract_declared_dependencies.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def parse_sources(
368368
yield from parse_source(source, parser_choice=parser_choice)
369369

370370

371-
def is_valid_deps_source(
371+
def validate_deps_source(
372372
path: Path,
373373
parser_choice: Optional[ParserChoice] = None,
374374
filter_by_parser: bool = False,

fawltydeps/extract_imports.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def parse_sources(
209209
yield from parse_source(source, stdin)
210210

211211

212-
def is_valid_code_source(
212+
def validate_code_source(
213213
path: PathOrSpecial, base_dir: Optional[Path] = None
214214
) -> Optional[CodeSource]:
215215
"""Check if the given file path is a valid source for parsing imports.

fawltydeps/traverse_project.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from pathlib import Path
44
from typing import AbstractSet, Dict, Iterator, Optional, Set, Type
55

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
88
from fawltydeps.settings import Settings
99
from fawltydeps.types import CodeSource, DepsSource, Source, UnparseablePathException
1010
from fawltydeps.utils import walk_dir
@@ -26,7 +26,7 @@ def find_sources(
2626
dirs_to_traverse: Dict[Path, Set[Type[Source]]] = {}
2727

2828
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
3030
if validated is not None: # parse-able file given directly
3131
assert isinstance(validated, CodeSource) # sanity check
3232
yield validated
@@ -35,7 +35,7 @@ def find_sources(
3535
dirs_to_traverse.setdefault(path, set()).add(CodeSource)
3636

3737
for path in settings.deps if DepsSource in source_types else []:
38-
validated = is_valid_deps_source(
38+
validated = validate_deps_source(
3939
path, settings.deps_parser_choice, filter_by_parser=False
4040
) # propagate exceptions
4141
if validated is not None: # parse-able file given directly
@@ -49,14 +49,14 @@ def find_sources(
4949
for file in walk_dir(dir_path): # traverse directories only _once_
5050
if CodeSource in types:
5151
try: # catch all exceptions while traversing dirs
52-
validated = is_valid_code_source(file, dir_path)
52+
validated = validate_code_source(file, dir_path)
5353
assert isinstance(validated, CodeSource) # sanity check
5454
yield validated
5555
except UnparseablePathException: # don't abort directory walk for this
5656
pass
5757
if DepsSource in types:
5858
try: # catch all exceptions while traversing dirs
59-
validated = is_valid_deps_source(
59+
validated = validate_deps_source(
6060
file, settings.deps_parser_choice, filter_by_parser=True
6161
)
6262
assert isinstance(validated, DepsSource) # sanity check

0 commit comments

Comments
 (0)