1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Python-language backend: scope model, AbcSize, used-once/never-used.
//!
//! Metric spec (mirrors the Rust backend's semantics where a direct
//! analogue exists):
//! - Units: every named `function_definition` (free functions, methods,
//! nested funcs). Lambdas are NOT units; their contents roll into the
//! enclosing unit (mirrors Ruby blocks / Rust closures). Nested
//! function/class definitions never descend into a parent's score --
//! those carry their own offense.
//! - A: assignments (+1 per written identifier target), augmented
//! assignments, walrus expressions, `for` and comprehension loop
//! targets.
//! - B: calls, attribute reads, subscripts, arithmetic/bitwise/unary
//! operators, f-string interpolations.
//! - C: if / elif / while / for (incl. async forms), comprehension
//! for/if clauses, ternary conditional expressions, each except
//! clause, each match case arm, comparisons, `and`/`or`.
//! - UsedOnce: single non-augmented write, pure RHS, straight-line
//! write position, single read after the write. Parameters, loop and
//! `with ... as` / `except ... as` bindings, imports and
//! underscore-prefixed names are excluded.
//! - NeverUsed: written but never read, reported at the first write;
//! same exclusions.
pub
use Tree;
use Scope;
pub use ;