Sample
pyint-8496a2685137-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.743 | 0–1; higher is more readable |
| Mi | 0.598 | 0–1; higher is more readable |
| LLOC | 177 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 6.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 12.67 | 0–20; mean of three runs |
| BTTF | 0.404 | 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. | 10739.276 | −354.396 |
| Source linesThe number of non-empty source lines. | 338 | +135.2 |
| 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.378 | −6.566 |
Intercept 8.87 + feature contributions = -216.892 (log-odds).
Score = sigmoid(-216.892) = 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. | 339 | −10.967 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 238 | +7.495 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 337.815 | +4.312 |
| 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. | 133.973 | −2.009 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 133.971 | +1.357 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.055 | +0.405 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
Intercept 0.07 + feature contributions = 1.062 (log-odds).
Score = sigmoid(1.062) = 0.743.
| Score | 0.598 |
|---|
| Score | 177 |
|---|
Run 1
The code has some readable aspects, such as clear docstrings and type hints, but it is severely undermined by bizarre implementation choices. The repeated use of `__import__('builtins').iter()` and `__import__('builtins').next()` instead of Python's built-in `for` loop is obfuscated and unnecessarily verbose, breaking natural reading flow. This pattern creates deeply nested while/try/except blocks, increasing cognitive load. Several methods (iterkeys, itervalues, iteritems, list_domains, list_paths, get_dict, _find, update) duplicate this convoluted iteration logic instead of using a simple `for cookie in self`. The code also mixes multiple actions per line in some conditions and suffers from disorganized structure due to repetitive boilerplate. While class-level documentation and some method intentions are clear, the execution details make the code much harder to read than necessary.
Run 2
The code suffers from severe readability issues despite having clear docstrings and type hints. The most glaring problem is the repeated use of `__import__('builtins').iter(iter(self))` and `__import__('builtins').next(loopIterator)` instead of simply using `for cookie in self:` loops. This creates massive verbosity and completely destroys the natural reading flow. The code is unnecessarily long—each iteration method repeats the same awkward boilerplate pattern (loopIteratorA through G), when a simple for loop would suffice in 2-3 lines. While the class structure is logical and methods have clear names, the action granularity is poor: multiple unnecessary statements per simple iteration. The nesting level is acceptable, but the intent of the iteration pattern is obfuscated by bizarre import calls. The inconsistent naming (loopIteratorA, loopIteratorB, etc.) suggests copy-paste coding. The use of walrus operator in set_cookie is clear, but it's overshadowed by the surrounding mess. Docstrings are excellent, but they can't compensate for the core iteration pattern being fundamentally unreadable.
Run 3
The code has some readability strengths, including clear docstrings, type hints, and logical class organization. However, it is severely undermined by bizarre and inconsistent iterator implementations. The repeated use of `__import__('builtins').iter/next/StopIteration` inside manual while-loops is a major red flag: it is obscure, non-idiomatic, and seems designed to avoid normal language constructs. This pattern appears in nine methods, creating massive duplication and obscuring intent. The code also mixes naming styles (camelCase loop variables vs snake_case), uses unnecessary type-ignore comments, and has inconsistent formatting. The `multiple_domains` logic appears inverted. While individual method docstrings are clear, the overall reading flow is jarring due to the unnatural iteration pattern and scattered imports. Readability would improve dramatically by replacing these loops with simple `for cookie in self` constructs and standard exception handling. As written, the code reads like intentionally obfuscated Python despite otherwise clean documentation and structure.
Run 1
1. Code Structure: Methods are logically grouped within a cohesive class, with clear separation of mapping operations, lookup helpers, and serialization. Import ordering is inconsistent. 2. Nesting: Most methods are shallow, but lookup helpers contain deeply nested conditions, and manual iteration adds unnecessary try/except nesting. 3. Clarity of intent: Descriptive method names, type hints, and docstrings clarify purpose. Generic iterator names and a mismatch between multiple_domains() documentation and its duplicate-domain check undermine clarity. 4. Code length: Repeated manual iterator machinery and dynamic builtins imports make simple loops unnecessarily verbose; some documentation is repetitive. 5. Action granularity: Statements generally perform one action per line, although dynamic imports embedded in iterator operations add distracting complexity. 6. Reading flow: Method boundaries and consistent formatting support navigation, but repeated while/try/except patterns interrupt natural reading compared with ordinary for loops.
Run 2
Code Structure: Well-organized class with focused methods and recognizable mapping operations, though imports are inconsistently grouped. Nesting: Most methods are shallow, but lookup methods contain several nested conditions that could be flattened. Clarity of intent: Descriptive method names, type annotations, and extensive docstrings explain the API well; generic camelCase variables and repeated dynamic builtins imports obscure otherwise simple iteration. Code length: Unnecessarily verbose manual iterator handling repeats try/except blocks where ordinary for loops would suffice; some documentation is repetitive. Action granularity: Statements generally perform one action per line, with few readability concerns. Reading flow: Method grouping and delegation provide a natural progression, but iteration boilerplate, long inline suppression comments, and inconsistent naming interrupt scanning. Overall, the interface is understandable, but implementation verbosity and nesting materially reduce readability.
Run 3
Code Structure: Methods are logically separated within a cohesive class, with clear grouping of mapping operations and cookie utilities. Nesting: Most methods are shallow, but lookup methods contain unnecessarily deep conditional chains. Clarity of intent: Descriptive method names, type annotations, and extensive docstrings help, although generic iterator names and some documentation/implementation mismatches introduce ambiguity. Code length: Repeated manual iterator setup, while loops, and StopIteration handling substantially inflate code that simple for loops could express. Action granularity: Statements generally perform one action per line, though dynamic imports and the assignment expression add complexity within expressions. Reading flow: Method organization is predictable, but repeated __import__("builtins") calls, inconsistent naming conventions, long inline comments, and verbose iteration machinery interrupt otherwise natural Python reading flow.