Sample
pyint-2ac18024ca6b-I05
Rewrite eligible decimal integer literals in hexadecimal notation
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 | 15 | 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 well-structured and readable, but has several issues that prevent a higher score. The class hierarchy is clear and methods are logically organized. Nesting is minimal and flat. Naming is good (LookupDict, key, default). Type hints are comprehensive. However, there are logic bugs that harm clarity: __getitem__ and get() use self.__dict__ instead of the dict itself, which makes the intent confusing. The __getattr__ raises AttributeError even when keys exist in __dict__, which seems contradictory. Action granularity is mostly good, though some lines could be broken up. The reading flow is natural, but the inconsistency between using dict inheritance and __dict__ access creates ambiguity. The overloads are well-placed but add complexity. Overall, the structure is sound but the implementation logic makes the intent unclear, earning a moderate score.
Run 3
The code is highly readable with clear structure: a single class with well-documented methods, each performing one focused action. Nesting is minimal (one level in __getattr__ and get methods), maintaining flat structure. Intent is explicit through descriptive names like `__getattr__`, `__getitem__`, and `get`, with helpful docstrings explaining fall-through behavior. Code length is appropriate - no unnecessary verbosity. Type hints and overloads enhance clarity without clutter. Reading flow is natural: class definition, then initialization, representation, attribute access, item access, and method overloading. Comments explain non-obvious typing choices. Minor deductions: the `name: Any` type could be more specific, and the `__dict__` access pattern is slightly unusual, but overall this demonstrates clean, maintainable code that balances documentation with conciseness.
Run 1
Code Structure: Methods are logically grouped in a small class, although unused imports and undefined type variables in the snippet add distraction. Nesting: Minimal nesting makes control flow easy to follow; the else after a return is unnecessary. Clarity of intent: Method names, annotations, and comments explain lookup behavior, but using __dict__ rather than dictionary storage is surprising for a dict subclass, and the class docstring is vague. Code length: Generally concise, with some extra whitespace and typing boilerplate. Action granularity: Each statement performs a single clear action. Reading flow: Initialization, representation, attribute access, item access, and get appear in a natural sequence, though overload declarations slightly interrupt the flow.
Run 2
Code Structure: A well-organized class separates initialization, representation, attribute access, and lookup into focused methods. Nesting: Minimal nesting makes control flow easy to follow, although the else after a return is unnecessary. Clarity of intent: Descriptive method names, annotations, and comments explain most behavior, but looking up values in __dict__ rather than the inherited dictionary is surprising. _VT and _D are not defined in the snippet, and several unused imports add distraction. Code length: Compact overall, with modest overhead from overload declarations that clarify typing. Action granularity: Each line generally performs one action. Reading flow: Methods follow a natural progression, though sparse class documentation and the unconventional storage behavior require extra interpretation.
Run 3
Code Structure: A cohesive class separates initialization, representation, attribute access, and lookup into small methods; however, type variables are not defined in the snippet and some imports appear unused. Nesting: Very shallow, with only one simple conditional. Clarity of intent: Type annotations and comments explain lookup behavior, but storing and retrieving values through __dict__ rather than the inherited dictionary is surprising and deserves clearer documentation. Code length: Concise overall; the else after a return and explicit None default in __dict__.get are unnecessary. Action granularity: Each line generally performs one action, with compact overload declarations remaining readable. Reading flow: Methods follow a natural progression, though excess blank space and typing scaffolding slightly interrupt the flow.