pub struct PythonProject {
pub root_dir: PathBuf,
pub module_map: HashMap<String, PathBuf>,
pub file_contents: HashMap<PathBuf, String>,
pub dependencies: HashMap<String, HashSet<String>>,
pub circular_dependencies: HashMap<String, HashSet<String>>,
pub dynamic_imports: HashMap<String, Vec<String>>,
pub star_imports: HashMap<String, Vec<String>>,
pub import_aliases: HashMap<String, HashMap<String, String>>,
pub conditional_imports: HashMap<String, Vec<ConditionalImport>>,
}Expand description
Structure representing a Python project
Fields§
§root_dir: PathBufRoot directory of the project
module_map: HashMap<String, PathBuf>Map of module paths to file paths
file_contents: HashMap<PathBuf, String>Map of file paths to their content
dependencies: HashMap<String, HashSet<String>>Dependency graph between modules
circular_dependencies: HashMap<String, HashSet<String>>Map to track circular dependencies
dynamic_imports: HashMap<String, Vec<String>>Map of modules that use dynamic imports
star_imports: HashMap<String, Vec<String>>Map of modules that use star imports
import_aliases: HashMap<String, HashMap<String, String>>Map to track import aliases
conditional_imports: HashMap<String, Vec<ConditionalImport>>Map of conditional imports (in try-except blocks)
Implementations§
Source§impl PythonProject
impl PythonProject
Sourcepub fn from_directory(dir: impl AsRef<Path>) -> Result<Self>
pub fn from_directory(dir: impl AsRef<Path>) -> Result<Self>
Create a new Python project from a directory
Sourcepub fn get_ordered_files(&self) -> Result<Vec<(PathBuf, String)>>
pub fn get_ordered_files(&self) -> Result<Vec<(PathBuf, String)>>
Get all files in topological order (dependencies first)
Sourcepub fn get_module_contents(&self) -> Vec<(String, (PathBuf, String))>
pub fn get_module_contents(&self) -> Vec<(String, (PathBuf, String))>
Get a map of module paths to (file_path, content) pairs
Sourcepub fn get_ir_imports(&self, module_path: &str) -> Vec<IRImport>
pub fn get_ir_imports(&self, module_path: &str) -> Vec<IRImport>
Convert all imports to IRImport objects
Auto Trait Implementations§
impl Freeze for PythonProject
impl RefUnwindSafe for PythonProject
impl Send for PythonProject
impl Sync for PythonProject
impl Unpin for PythonProject
impl UnwindSafe for PythonProject
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more