MCPcopy Create free account
hub / github.com/Glyphack/enderpy / get_python_files

Function get_python_files

compat/src/main.rs:45–58  ·  view source on GitHub ↗

Recursively finds all Python files in the specified directory.

(dir: &str)

Source from the content-addressed store, hash-verified

43
44/// Recursively finds all Python files in the specified directory.
45fn get_python_files(dir: &str) -> Result<Vec<String>> {
46 let mut python_files = Vec::new();
47 for entry in fs::read_dir(dir).into_diagnostic()? {
48 let entry = entry.into_diagnostic()?;
49 let path = entry.path();
50
51 if path.is_dir() {
52 python_files.extend(get_python_files(path.to_str().unwrap())?);
53 } else if path.extension().and_then(|ext| ext.to_str()) == Some("py") {
54 python_files.push(path.to_str().unwrap().to_string());
55 }
56 }
57 Ok(python_files)
58}
59
60/// Runs the compatibility test on a single Python file.
61fn run_compatibility_test(file: &str) -> Result<()> {

Callers 1

mainFunction · 0.85

Calls 2

pathMethod · 0.80
to_stringMethod · 0.80

Tested by

no test coverage detected