Sample
pyint-6d287e9910a8-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.704 | 0–1; higher is more readable |
| Mi | 0.301 | 0–1; higher is more readable |
| LLOC | 25 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 13.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15 | 0–20; mean of three runs |
| BTTF | 0.516 | 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. | 1312.4 | −43.309 |
| Source linesThe number of non-empty source lines. | 37 | +14.8 |
| 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.607 | −6.91 |
Intercept 8.87 + feature contributions = -26.549 (log-odds).
Score = sigmoid(-26.549) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 108 | +0.938 |
| 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. | 108 | −0.909 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 33 | +0.404 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 36 | −0.238 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 36.761 | +0.104 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.087 | +0.099 |
Intercept 0.07 + feature contributions = 0.866 (log-odds).
Score = sigmoid(0.866) = 0.704.
| Score | 0.301 |
|---|
| Score | 25 |
|---|
Run 1
The code has logical organization and clear intent but suffers from several readability issues. The class structure is straightforward, but the action granularity is inconsistent: the AttributeError construction is unnecessarily split across multiple lines with odd spacing. The import section omits necessary type variables (_VT, _D), making the code ambiguous and incomplete. Nesting is minimal, and reading flow is generally natural, but the overloaded get methods add complexity without explanation. The __getattr__ method contains a redundant if-else that could be simplified. Overall, the code is functional but could benefit from cleaner formatting, complete type definitions, and simpler fall-through handling for better readability.
Run 2
The code shows reasonable intent with clear dictionary lookup semantics and useful type hints, but has structural problems that hurt readability. The class definition references undefined types (_VT, _D) without imports or TypeVar declarations, making the type system confusing. The __getattr__ method breaks return type consistency by returning an instance attribute when present but raising otherwise, while __getitem__ silently returns None for missing keys—this asymmetry obscures intent. Formatting is inconsistent: the AttributeError argument is awkwardly split across lines with odd indentation, making that block harder to scan. Missing blank lines between methods and the misplaced type ignore comment further reduce visual structure. The code is relatively short and avoids deep nesting, but lacks the logical organization and clear action granularity expected for a membership dict wrapper. The natural reading flow is also disrupted by incomplete generic plumbing.
Run 3
The code has a clear purpose and uses type hints well, but several structural issues reduce readability. The LookupDict class extends dict but overrides __getitem__ to read from __dict__, which is confusing and breaks expected dict behavior. __getattr__ and __getitem__ have inconsistent error handling — one raises, the other silently returns None. The __repr__ has an odd formatting break, and there is an unnecessary multi-line string split in the AttributeError. Action granularity is generally acceptable, and nesting is minimal. However, the logic mixing __dict__ and dict inheritance makes intent ambiguous. The overloads are helpful but add verbosity. Overall, the code is understandable but could be clearer with simpler data flow and fewer surprises in mapping behavior.
Run 1
Code Structure: Methods are logically grouped in a small class, though unused imports and undefined type variables (_VT and _D) make the snippet less self-contained. Nesting: Minimal, with only a simple conditional; the else after a return is unnecessary. Clarity of intent: Method names, annotations, and comments help, but storing lookup values in __dict__ rather than the inherited dictionary is surprising and insufficiently explained. Code length: Concise overall; overloads add justified typing detail. Action granularity: Each statement performs one clear action. Reading flow: Mostly natural, but awkward spacing in the AttributeError call and missing separation between methods interrupt readability.
Run 2
Code Structure: Methods are logically grouped within a small class, though unused imports and undefined type variables distract. Nesting: Mostly flat, with only a simple conditional in __getattr__. Clarity of intent: Method names, annotations, and comments help, but storing lookup values in __dict__ rather than the inherited dictionary is surprising and insufficiently explained. Code length: Concise overall; overloads add useful typing detail, while the else after a raising branch is unnecessary. Action granularity: Each line generally performs one action. Reading flow: Conventional method ordering supports easy reading, but awkward spacing in the AttributeError call and the missing blank line before __getitem__ interrupt the flow.
Run 3
Code Structure: Methods are logically grouped within a small class, though unused imports and undefined type variables distract. Nesting: Mostly flat, with only a simple conditional in attribute lookup. Clarity of intent: Method names, annotations, and comments explain lookup behavior, but storing values in __dict__ rather than the inherited dictionary is surprising, and the class docstring is vague. Code length: Concise overall; overloads add useful typing detail, while the else after a raise-capable branch is unnecessary. Action granularity: Each statement performs a single action, making individual operations easy to follow. Reading flow: Initialization, representation, and lookup methods follow a natural sequence, but malformed-looking spacing around AttributeError and the missing blank line before __getitem__ interrupt readability.