Skip to main content

py_canon/
lib.rs

1//! `py-canon` — the Python [`Frontend`](dup_defs_core::Frontend) for `find-dup-defs`, over Ruff's
2//! native parser (modern syntax: PEP 695 / 701).
3//!
4//! [`Python`] walks each file once and lowers every top-level function / class / constant /
5//! type-alias and class method to a [`Def`](dup_defs_core::Def), computing its canonical strings
6//! off the AST node — a `CPython` `ast.dump`-shaped, name-preserving, docstring-stripped
7//! structural canonical (the representation `difflib-fast` clusters). [`ast_canonical`] /
8//! [`analyze_functions`] expose that canonicalization over a source string for tooling /
9//! golden checks; [`LineMap`] and [`AnalyzedFn`] are the supporting source-location / analysis
10//! types.
11
12mod canon;
13mod defs;
14mod frontend;
15
16pub use canon::{analyze_functions, ast_canonical, ast_canonical_many, normalize_functions, AnalyzedFn};
17pub use dup_defs_core::LineMap;
18pub use frontend::{Python, CLASSES, CONSTANTS, FUNCTIONS, METHODS, TYPE_ALIASES};