Skip to content

Commit

Permalink
Remove ouroboros
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter554 committed Nov 26, 2023
1 parent ff0eef7 commit dc82776
Show file tree
Hide file tree
Showing 9 changed files with 291 additions and 283 deletions.
68 changes: 0 additions & 68 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ edition = "2021"
[dependencies]
anyhow = "1.0.75"
maplit = "1.0.2"
ouroboros = "0.18.0"
pathfinding = "4.3.3"
rayon = "1.8.0"
rustpython-parser = "0.3.0"
Expand Down
21 changes: 19 additions & 2 deletions src/import_graph/builder.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
use anyhow::Result;
use std::path::{Path, PathBuf};
use std::sync::Arc;

use super::graph;
use super::import_discovery;
use super::indexing;
use super::package_discovery;

pub struct ImportGraphBuilder {
pub(super) root_package_path: PathBuf, // ignored_imports
Expand All @@ -16,7 +20,20 @@ impl ImportGraphBuilder {
}
}

pub fn build(self) -> Result<graph::ImportGraph> {
graph::ImportGraph::build(self)
pub fn build(&self) -> Result<graph::ImportGraph> {
let root_package = package_discovery::discover_package(self.root_package_path.as_path())?;
let packages_by_pypath = indexing::get_packages_by_pypath(Arc::clone(&root_package))?;
let modules_by_pypath = indexing::get_modules_by_pypath(Arc::clone(&root_package))?;
let packages_by_module = indexing::get_packages_by_module(Arc::clone(&root_package))?;
let imports =
import_discovery::discover_imports(Arc::clone(&root_package), &modules_by_pypath)?;
let reverse_imports = indexing::reverse_imports(&imports)?;
Ok(graph::ImportGraph {
packages_by_pypath,
modules_by_pypath,
packages_by_module,
imports,
reverse_imports,
})
}
}
Loading

0 comments on commit dc82776

Please sign in to comment.