MCPcopy Create free account
hub / github.com/NanmiCoder/MediaCrawler / find_python_files

Function find_python_files

tools/file_header_manager.py:213–237  ·  view source on GitHub ↗

Find all Python files Args: root_dir: Root directory exclude_patterns: Directory patterns to exclude Returns: List of Python file paths

(root_dir: str, exclude_patterns: List[str] = None)

Source from the content-addressed store, hash-verified

211
212
213def find_python_files(root_dir: str, exclude_patterns: List[str] = None) -> List[str]:
214 """
215 Find all Python files
216
217 Args:
218 root_dir: Root directory
219 exclude_patterns: Directory patterns to exclude
220
221 Returns:
222 List of Python file paths
223 """
224 if exclude_patterns is None:
225 exclude_patterns = ['venv', '.venv', 'node_modules', '__pycache__', '.git', 'build', 'dist', '.eggs']
226
227 python_files = []
228
229 for root, dirs, files in os.walk(root_dir):
230 # Exclude specific directories
231 dirs[:] = [d for d in dirs if d not in exclude_patterns and not d.startswith('.')]
232
233 for file in files:
234 if file.endswith('.py'):
235 python_files.append(os.path.join(root, file))
236
237 return sorted(python_files)
238
239
240def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected