Sample
pyint-ae72dda9b5a2-I03
Replace names with length-matched meaningful but unrelated identifiers
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.001 | 0–1; higher is more readable |
| Dorn | 0.755 | 0–1; higher is more readable |
| Mi | 0.589 | 0–1; higher is more readable |
| LLOC | 27 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 13.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.576 | 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.213 | −6.32 |
Intercept 8.87 + feature contributions = -7.421 (log-odds).
Score = sigmoid(-7.421) = 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.94 | +0.491 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.05 | +0.46 |
| 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.763 | +0.272 |
Intercept 0.07 + feature contributions = 1.125 (log-odds).
Score = sigmoid(1.125) = 0.755.
| Score | 0.589 |
|---|
| Score | 27 |
|---|
Run 1
The code is generally readable but has several clarity issues. The class name '_AnnotationExtractor' and method names 'validateAddress' and 'validateAccount' poorly describe their actual purpose (extracting argument/return type annotations), which obscures intent. The 'nextNode' parameter is ambiguously named—it should be 'callable_obj' or similar. While nesting is minimal and structure is logical, the methods do redundant imports and have inconsistent validation logic (e.g., 'validateAccount' checks 'inspect.Signature.empty' while '__init__' catches exceptions differently). Some unnecessary imports ('sys', 'threading', '_GenericAlias') add noise. The docstrings help, but naming inconsistencies and semantic mismatch between method names and their behavior reduce overall clarity.
Run 2
The code is generally readable with clear docstrings and logical separation, but it has several issues. Class and method names are misleading (e.g., validateAddress/validateAccount suggest unrelated functionality). The class stores only `sig` but imports `inspect` inside methods, adding unnecessary complexity. Conditional logic is mostly flat, but the return/None patterns are repetitive. Action granularity is acceptable, and reading flow is natural, though the unused `nextNode` parameter name is vague. Overall intent is understandable but could be clearer with better naming and simpler structure.
Run 3
The code has a clear purpose and some logical separation with an initializer and two validation methods. However, readability suffers from several issues: the class name (_AnnotationExtractor) is somewhat vague; method names (validateAddress, validateAccount) are misleading given they return annotations; and imports are placed inside methods unnecessarily. The code partially avoids deep nesting, but the conditional checks are verbose. Length is reasonable, though redundant import statements (inspect) and unused imports reduce cleanliness. Action granularity is mostly one action per line, but some lines combine operations (e.g., status[0].annotation checks). Reading flow is disrupted by inconsistent naming and import placement. Overall, it is understandable but not highly polished.
Run 1
Code Structure: The class cleanly separates signature extraction from parameter and return annotation retrieval, though unused imports add clutter. Nesting: Shallow conditionals and early returns keep control flow easy to follow. Clarity of intent: Docstrings explain behavior, but validateAddress and validateAccount misleadingly suggest validation rather than annotation retrieval; nextNode and status are also vague names. Code length: The implementation is compact, although repeated local inspect imports and converting all parameters to a list introduce minor overhead and distraction. Action granularity: Each statement performs a clear, individual action. Reading flow: Initialization followed by two retrieval methods is natural, with consistent spacing and straightforward exception handling.
Run 2
Code Structure: The class logically groups signature extraction and annotation access, although unused imports add clutter. Nesting: Shallow conditionals and early returns make control flow easy to follow. Clarity of intent: Docstrings clearly explain behavior, but validateAddress and validateAccount misleadingly suggest validation rather than annotation retrieval; nextNode and status are also vague names. Code length: Compact overall, though repeated local inspect imports and converting all parameters to a list introduce minor unnecessary complexity. Action granularity: Each statement performs a distinct action, with no compressed multi-action lines. Reading flow: Initialization followed by argument and return annotation retrieval forms a natural sequence. The multiline return-annotation condition slightly interrupts flow, and inconsistent naming conventions reduce polish.
Run 3
Code Structure: A small class logically groups signature extraction and annotation access, though unused imports add clutter. Nesting: Shallow conditionals and early returns make control flow easy to follow. Clarity of intent: Docstrings clearly describe behavior, but validateAddress and validateAccount misleadingly suggest validation rather than annotation retrieval; nextNode and status are also vague names. Code length: Compact overall, with minor repetition from local inspect imports and explicit None returns. Action granularity: Statements generally perform one action per line, supporting readability. Reading flow: Initialization followed by two accessor-like methods is natural, although inconsistent naming conventions and the unnecessarily wrapped return-annotation condition slightly interrupt the flow.