Sample
pyint-ee897172cdc8-I13
Lower every eligible synchronous for loop to a while loop
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 readable but has several clarity issues. The class structure is logical with clear method separation, and nesting is minimal. However, the intent is ambiguous: LookupDict inherits from dict but overrides __getitem__ to look in __dict__ instead of the dict itself, which is surprising and confusing. The __getattr__ implementation seems counterintuitive—it checks if the key exists in __dict__ but then returns it, otherwise raises AttributeError, yet the docstring implies fall-through behavior. Method docstrings are sparse and don't explain the unusual design. Type hints add complexity, especially the overloads on get(). The code is concise but could benefit from better documentation of its non-standard behavior. Reading flow is adequate.
Run 3
The code is highly readable with a clear purpose: creating a dictionary subclass with attribute-style access and None default behavior. Structure is logical, grouping initialization, representation, attribute access, and item access. Nesting is minimal (one level in __getattr__). Intent is explicit through type hints, overloads, and comments explaining design decisions like fall-through behavior and type-checker compatibility. Code length is concise without sacrificing clarity. Each method performs a single action, and the reading flow progresses naturally from construction to access patterns. Minor deductions: the __getitem__ implementation bypasses the parent dict entirely by accessing __dict__, which could confuse readers about intended storage semantics, and the overload blocks add slight verbosity. The type-ignore comment is necessary but interrupts flow slightly. Overall, the code is well-structured and maintainable, with strong typing support that enhances rather than obscures readability.
Run 1
Code Structure: The class is logically organized into initialization, representation, attribute access, and lookup methods, although unused imports and undefined type variables distract. Nesting: Minimal nesting keeps methods easy to follow; the else after a return is unnecessary. Clarity of intent: Names, type annotations, and comments explain lookup behavior, but storing lookups in __dict__ rather than the inherited dictionary is surprising and insufficiently documented. Code length: Methods are concise, though overloads add some visual overhead. Action granularity: Each line generally performs one action, with no compressed multi-statement logic. Reading flow: Consistent formatting and short methods support natural reading, but the mismatch between dict inheritance and attribute-backed retrieval requires extra interpretation.
Run 2
Code Structure: A well-organized class separates initialization, representation, attribute lookup, item lookup, and get behavior. Nesting: Minimal nesting; only a simple if/else appears. Clarity of intent: Type annotations and comments help, but looking up values in __dict__ rather than the inherited dictionary is surprising, and _VT and _D are not defined in the snippet. Code length: Concise overall, though unused imports, an unnecessary else after return, and extra whitespace add minor clutter. Action granularity: Each line generally performs one action, with short, focused methods. Reading flow: Methods follow a natural sequence, and overloads sit directly above their implementation; however, the sparse class docstring does not explain the unusual lookup semantics.
Run 3
Code Structure: Imports and a single class with short, focused methods provide logical organization, though _VT and _D are not defined in the snippet. Nesting: Minimal nesting makes control flow easy to follow; the else after a returning branch is unnecessary. Clarity of intent: Type annotations and comments explain lookup behavior, but storing lookup values in __dict__ rather than the inherited dictionary is surprising, and the class docstring is vague. Code length: Concise overall, with justified overload declarations and a few dispensable blank lines. Action granularity: Each statement performs one clear action. Reading flow: Methods progress naturally from initialization and representation to attribute and item lookup, then get; dense generic annotations and the override suppression introduce minor friction.