MCPcopy Create free account
hub / github.com/LaBatata101/sith-language-server / is_python_module

Function is_python_module

crates/sith_python_utils/src/lib.rs:189–193  ·  view source on GitHub ↗

Checks if the symbol name correspond to the file path in the form `bar/__init__.py` or `foo/bar.py`.

(name: &str, path: &Path)

Source from the content-addressed store, hash-verified

187/// Checks if the symbol name correspond to the file path in the form `bar/__init__.py`
188/// or `foo/bar.py`.
189pub fn is_python_module(name: &str, path: &Path) -> bool {
190 is_python_dir_module(name, path)
191 || path.ends_with(format!("{name}.py"))
192 || path.ends_with(format!("{name}.pyi"))
193}
194
195fn is_python_dir_module(name: &str, path: &Path) -> bool {
196 path.ends_with(format!("{name}/__init__.py")) || path.ends_with(format!("{name}/__init__.pyi"))

Callers 3

push_declarationMethod · 0.85
is_imported_moduleMethod · 0.85
infer_imported_symbolMethod · 0.85

Calls 1

is_python_dir_moduleFunction · 0.85

Tested by

no test coverage detected