MCPcopy Create free account
hub / github.com/espnet/espnet / find_python_files

Function find_python_files

utils/apply_code_fixes.py:19–45  ·  view source on GitHub ↗

Find all Python files in the given directory. Args: directory: The directory to search for Python files. exclude_dirs: List of directory names to exclude from the search. Returns: A list of paths to Python files.

(
    directory: str, exclude_dirs: Optional[List[str]] = None
)

Source from the content-addressed store, hash-verified

17
18
19def find_python_files(
20 directory: str, exclude_dirs: Optional[List[str]] = None
21) -> List[str]:
22 """Find all Python files in the given directory.
23
24 Args:
25 directory: The directory to search for Python files.
26 exclude_dirs: List of directory names to exclude from the search.
27
28 Returns:
29 A list of paths to Python files.
30 """
31 if exclude_dirs is None:
32 exclude_dirs = []
33
34 exclude_set = set(exclude_dirs)
35 python_files = []
36
37 for root, dirs, files in os.walk(directory):
38 # Skip excluded directories
39 dirs[:] = [d for d in dirs if d not in exclude_set]
40
41 for file in files:
42 if file.endswith(".py"):
43 python_files.append(os.path.join(root, file))
44
45 return python_files
46
47
48def run_pycodestyle(paths: List[str], exclude: Optional[List[str]] = None) -> str:

Callers 1

mainFunction · 0.85

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…