Sample
pyint-d6adc2c7f9cc-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.297 | 0–1; higher is more readable |
| Mi | 0.472 | 0–1; higher is more readable |
| LLOC | 35 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 18 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.67 | 0–20; mean of three runs |
| BTTF | 0.503 | 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. | 2440.842 | −80.548 |
| Source linesThe number of non-empty source lines. | 80 | +32 |
| 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.718 | −7.077 |
Intercept 8.87 + feature contributions = -46.755 (log-odds).
Score = sigmoid(-46.755) = 0.
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. | 81 | −1.832 |
| 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. | 119.975 | −1.416 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 119.988 | +1.131 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 50 | +0.992 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 51 | −0.749 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 79.802 | +0.706 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.072 | +0.238 |
Intercept 0.07 + feature contributions = -0.86 (log-odds).
Score = sigmoid(-0.86) = 0.297.
| Score | 0.472 |
|---|
| Score | 35 |
|---|
Run 1
The code is highly readable with a clear, logical class structure. It uses type hints, a docstring with examples, and consistent method definitions. Nesting is minimal—only one conditional in __eq__—and actions are generally one per line. The intent of each method is obvious from its name and implementation. The code is concise but not overly terse, and the reading flow follows a natural order (init, item methods, iteration, length, comparison, copy, repr). Minor deductions could be made for the slightly long __eq__ method and the reliance on type: ignore, but they do not harm overall clarity.
Run 2
The code is well-structured with clear separation of concerns: imports, class definition, type hints, and method implementations are logically organized. Each method has a single, focused responsibility and the action granularity is appropriate with one operation per line. Nesting is minimal and flat, especially in methods like __iter__ and __eq__. The intent of the CaseInsensitiveDict is clearly documented in the docstring with practical examples, and comments explain the internal storage strategy. Type hints throughout enhance readability. The code length is reasonable without unnecessary verbosity. Reading flow is natural as methods follow standard MutableMapping patterns. Minor deductions: the type ignore comment in __eq__ slightly interrupts flow, and the lower_items return statement uses a generator expression wrapped in parentheses that could arguably be simpler.
Run 3
The code is highly readable. It has a clear class-level docstring explaining behavior and edge cases. Structure is logical and flat, with minimal nesting. Methods are concise and follow single-action-per-line patterns. Naming and type hints clarify intent. The use of helper methods like lower_items and the OrderedDict store make the case-insensitive design transparent. A few minor improvements could be made by extracting a helper for key normalization or adding a comment for the return-not-implemented branch, but overall it is clean and maintainable.
Run 1
Code Structure: Well-organized mapping class with focused methods and a clearly defined internal representation. Nesting: Minimal, with only simple conditionals and generator expressions. Clarity of intent: Descriptive names, type annotations, comments, and a comprehensive docstring explain case-insensitive behavior well; however, _VT is not defined in the snippet, and references to legacy iteration methods are distracting. Code length: Methods are concise, though the docstring is comparatively lengthy and some imports are unused. Action granularity: Statements generally perform one action per line; the equality conversion line is slightly crowded by its annotation and suppression comment. Reading flow: Natural progression from initialization through mapping operations to equality, copying, and representation. Overall, highly readable with minor annotation and documentation distractions.
Run 2
Code Structure: Well-organized class with small, focused methods implementing the mapping interface. Nesting: Minimal branching and no deeply nested blocks. Clarity of intent: The descriptive class name, extensive docstring, type annotations, and storage comment clearly explain case-insensitive behavior; however, _VT is not defined in the snippet, and names such as keyval are less expressive. Code length: Implementation is concise, though the docstring is relatively lengthy and the equality conversion line is unwieldy. Action granularity: Statements generally perform one action per line; generator expressions remain compact and understandable. Reading flow: Methods follow a natural sequence from initialization through core mapping operations to comparison, copying, and representation. Minor distractions include unused TypeVar and overload imports and the inline type-ignore annotation.
Run 3
Code Structure: Well-organized class with short, focused methods implementing the mapping interface. Nesting: Minimal branching and no deeply nested blocks. Clarity of intent: The detailed docstring, type annotations, and storage comment clearly explain case-insensitive lookup and preserved casing; however, _VT is never defined despite importing TypeVar, and names such as keyval are less descriptive. Code length: Implementation is concise, though the docstring is relatively long and overload is unused. Action granularity: Statements generally perform one action per line; generator expressions remain compact and understandable. Reading flow: Methods follow a natural sequence from initialization through core operations, comparison, copying, and representation. The long inline type-ignore comment and tuple indexing slightly interrupt an otherwise smooth reading experience.