Sample
pyint-d900a3e28389-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.001 | 0–1; higher is more readable |
| Dorn | 0.755 | 0–1; higher is more readable |
| Mi | 0.591 | 0–1; higher is more readable |
| LLOC | 27 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 0–20; mean of three runs |
| BTTF | 0.585 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones. | 896.111 | −29.572 |
| Source linesThe number of non-empty source lines. | 49 | +19.6 |
| Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value. | 4.211 | −6.317 |
Intercept 8.87 + feature contributions = -7.418 (log-odds).
Score = sigmoid(-7.418) = 0.001.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 49 | −0.699 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 40 | +0.646 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 40 | −0.497 |
| Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names. | 74.96 | +0.49 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.049 | +0.462 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 73.48 | +0.381 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 48.697 | +0.271 |
Intercept 0.07 + feature contributions = 1.125 (log-odds).
Score = sigmoid(1.125) = 0.755.
| Score | 0.591 |
|---|
| Score | 27 |
|---|
Run 1
The code is generally readable with clear class and method names, sensible docstrings, and consistent use of imports. Structure is logical, nesting is minimal, and actions are mostly one per line. Some issues slightly reduce clarity: the `__slots__` attribute is unnecessary for an extractor class, imports are scattered inside methods rather than centralized, and the `get_first_param_type` method creates a list unnecessarily. The conditional in `get_return_type` spans multiple lines and could be simplified for better flow. Overall, intent is clear but minor redundancies and import placement slightly hinder readability.
Run 2
The code is generally readable with clear naming and docstrings. However, several issues reduce its score: repeated 'import inspect' inside methods is unnecessary and disrupts flow; the class name '_AnnotationExtractor' suggests internal use but lacks clarity on purpose; nested conditionals in get_first_param_type and get_return_type could be flattened; the unused imports (sys, threading, Mapping, Sequence, Callable, _GenericAlias) add noise; and the class design could be simplified by extracting the signature once and returning None early. The structure is logical but somewhat over-engineered for the simple task. Overall, it's maintainable but not exemplary.
Run 3
The code is well-structured with a clear single responsibility class, flat nesting, and logical method separation. Imports inside methods are a minor inconsistency but intentional for lazy loading. Docstrings clearly explain intent. The 'get_first_param_type' method could be slightly simplified, and the top imports include 'Mapping', 'Sequence', and '_GenericAlias' that are unused, which adds minor noise. Overall readability is high due to concise methods, natural flow, and good naming.
Run 1
Code Structure: A focused class separates signature extraction from parameter and return annotation retrieval. Nesting: Shallow conditionals and early returns keep control flow simple. Clarity of intent: Descriptive method names and docstrings explain the purpose, although 'sig' is abbreviated and 'callable' shadows a built-in. Code length: Concise overall, but unused top-level imports and repeated local inspect imports add clutter. Action granularity: Each statement performs a clear, discrete action. Reading flow: Methods follow a natural initialization-and-query sequence, with consistent spacing and straightforward exception handling. The unnecessarily split return-type condition slightly interrupts an otherwise smooth reading experience.
Run 2
Code Structure: The class cleanly separates signature extraction from parameter and return annotation retrieval. Nesting: Minimal nesting and early returns make control paths easy to follow. Clarity of intent: Descriptive method names and brief docstrings clearly communicate purpose, although 'sig' is abbreviated and 'callable' shadows a built-in. Code length: Compact overall, but unused module imports and repeated local inspect imports add clutter. Action granularity: Each statement performs a single clear action, with no compressed multi-action lines. Reading flow: Initialization followed by two focused accessor methods creates a natural progression; the multiline return-annotation condition slightly interrupts an otherwise smooth flow.
Run 3
Code Structure: The class logically groups signature extraction and annotation access into small, focused methods. Nesting: Shallow conditionals and early returns keep complexity low. Clarity of intent: Descriptive method names and docstrings clearly explain the purpose, though the parameter name callable shadows a built-in and sig is abbreviated. Code length: Methods are concise, but repeated local inspect imports and several unused module imports add clutter. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: Initialization followed by parameter and return annotation retrieval creates a natural progression. The multiline return-annotation condition slightly interrupts an otherwise straightforward flow.