Python supercharged for fastai development
56
Build a code analysis tool that scans a project directory and generates statistics about the codebase.
The tool should provide the following functionality:
Search a given directory recursively to find all relevant source code files. The tool should support:
For each discovered file, collect the following metrics:
Generate and display summary statistics:
The tool should accept a directory path as input and output:
@generates
def find_files_by_pattern(root_dir: str, pattern: str) -> list:
"""
Find all files in root_dir matching the given pattern.
Args:
root_dir: Directory to search
pattern: File pattern to match (e.g., "*.py", "**/*_test.py")
Returns:
List of file paths matching the pattern
"""
pass
def find_files_by_extension(root_dir: str, extensions: list) -> dict:
"""
Find all files with specified extensions and group them by type.
Args:
root_dir: Directory to search
extensions: List of file extensions (e.g., ['.py', '.json'])
Returns:
Dictionary mapping extension to list of file paths
"""
pass
def analyze_file(filepath: str) -> dict:
"""
Analyze a single file and return metrics.
Args:
filepath: Path to the file
Returns:
Dictionary with keys: 'size', 'lines', 'modified_time'
"""
pass
def generate_statistics(root_dir: str, file_pattern: str = "**/*.py") -> dict:
"""
Generate comprehensive statistics for files matching the pattern.
Args:
root_dir: Directory to analyze
file_pattern: Pattern to match files
Returns:
Dictionary with keys: 'total_files', 'total_lines', 'avg_size', 'largest_files'
"""
passProvides file search and path utilities.
Install with Tessl CLI
npx tessl i tessl/pypi-fastcoredocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10