Sample
pyint-94ad14218745-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.854 | 0–1; higher is more readable |
| Mi | 0.484 | 0–1; higher is more readable |
| LLOC | 25 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.67 | 0–20; mean of three runs |
| BTTF | 0.552 | 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. | 41 | +16.4 |
| 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.61 | −6.915 |
Intercept 8.87 + feature contributions = -24.954 (log-odds).
Score = sigmoid(-24.954) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 37 | +0.543 |
| 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. | 75.952 | +0.448 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 74.286 | +0.394 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 39 | −0.345 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 40.805 | +0.161 |
| 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 = 1.768 (log-odds).
Score = sigmoid(1.768) = 0.854.
| Score | 0.484 |
|---|
| Score | 25 |
|---|
Run 1
The code is generally readable, with clear class naming and straightforward method definitions. However, several issues reduce clarity. The `LookupDict` is described as a dictionary lookup object, but its `__getitem__` and `get` methods read from `__dict__` rather than the dictionary itself, which is confusing and seems unintended. The `__getattr__` method has odd branching: it checks `key in self.__dict__`, returns the value if true, then raises AttributeError in the else, but never actually falls through—making the `if`/`else` redundant. The `__repr__` is concise and clear. The overloads for `get` add some complexity but are manageable. Overall, structure is okay but intent is ambiguous due to the mismatch between class purpose and internal behavior, and the action granularity varies (multiple actions in one line in `__getitem__`). The nesting is minimal, which is a positive.
Run 2
The code is generally readable with a clear structure and purpose. Each method is short and focused, maintaining good action granularity. However, there are significant readability issues: the 'get' method checks __dict__ instead of the dict itself, contradicting the class's dict inheritance and creating ambiguity. The __getattr__ and __getitem__ methods have confusing semantics — __getitem__ silently returns None for missing keys rather than raising KeyError, which violates dict expectations. Type annotations are helpful, but the generics (_VT, _D) are not defined in the visible code, requiring readers to infer them. The overloads for 'get' are somewhat verbose but acceptable. Nesting is minimal and beneficial. The class docstring is too brief for the unusual behavior implemented. Overall structure is clean, but clarity of intent and semantic consistency are compromised.
Run 3
The code is well-structured and maintains a clear purpose as a dictionary subclass with attribute-style access for HTTP status lookups. The class is logically organized with clear method separation and appropriate type hints. Nesting is minimal and the reading flow is natural, moving from initialization through representation to access methods. Each line performs a single action, and the code is concise without unnecessary verbosity. The overloaded get methods add some complexity but are properly documented. The main readability concerns are the placeholder type variables (_VT and _D) which are referenced but not defined in the visible code, making it difficult to understand the full type contract without seeing the complete module. Additionally, the @overload decorators and associated type checking comments add moderate cognitive overhead for readers unfamiliar with static typing patterns. Despite these minor issues, the code demonstrates good practices with clear docstrings and appropriate use of modern Python features.
Run 1
Code Structure: Methods are logically grouped within a small class, although unused imports and undefined type variables in the snippet distract. Nesting: Minimal nesting makes control flow easy to follow; the else after a return is unnecessary. Clarity of intent: Method names, annotations, and comments help, but a dict subclass that reads from __dict__ rather than dictionary storage is surprising and insufficiently explained. Code length: Concise overall, with some typing boilerplate and redundant get(key, None). Action granularity: Each line generally performs one action, and compact overload declarations remain understandable. Reading flow: Initialization, representation, attribute access, and lookup methods follow a natural progression, though missing type-variable definitions and the unusual storage model interrupt comprehension.
Run 2
Code Structure: Imports and a single class with short, focused methods provide logical organization, though the undefined type variables in the snippet obscure typing context. Nesting: Minimal nesting makes control flow easy to follow; the else after a return is unnecessary. Clarity of intent: Descriptive method names, type annotations, and comments help, but storing lookups in __dict__ rather than the inherited dictionary is surprising, and the class docstring does little to explain this behavior. Code length: Concise overall, with some typing boilerplate and a redundant explicit None default. Action granularity: Statements generally perform one action per line; compact overload declarations remain understandable. Reading flow: Methods progress naturally from initialization and representation to lookup operations, although inconsistent blank spacing and missing type-variable definitions slightly interrupt comprehension.
Run 3
Code Structure: Methods are logically grouped within a small class, with overloads placed directly before their implementation. Nesting: Minimal nesting makes control flow easy to follow, although the else after a returning branch is unnecessary. Clarity of intent: Method names, type annotations, and comments explain lookup behavior, but using instance attributes rather than dictionary entries is surprising for a dict subclass. The generic class docstring provides little context, and _VT and _D are not defined in the shown snippet. Code length: Concise overall, with modest typing boilerplate and an unnecessary blank line in __getitem__. Action granularity: Each statement performs a single clear action. Reading flow: Imports, initialization, representation, and lookup methods follow a natural sequence; dense union annotations and type-checking accommodations slightly interrupt the flow.