Sample
pyint-a4685cb58319-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.346 | 0–1; higher is more readable |
| Mi | 0.738 | 0–1; higher is more readable |
| LLOC | 58 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.67 | 0–20; mean of three runs |
| BTTF | 0.48 | 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. | 3811.44 | −125.778 |
| Source linesThe number of non-empty source lines. | 195 | +78 |
| 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.037 | −6.056 |
Intercept 8.87 + feature contributions = -44.964 (log-odds).
Score = sigmoid(-44.964) = 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. | 196 | −5.903 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 168 | +5.074 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 168 | −3.434 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 194.987 | +2.316 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.053 | +0.424 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 75.342 | +0.411 |
| 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. | 76.964 | +0.405 |
Intercept 0.07 + feature contributions = -0.638 (log-odds).
Score = sigmoid(-0.638) = 0.346.
| Score | 0.738 |
|---|
| Score | 58 |
|---|
Run 1
The code is generally well-structured and readable. It uses clear naming conventions, docstrings, and type hints. The class definition and methods are logically organized, and the use of `__slots__` improves clarity. However, there are some readability challenges. The `__attrs_attrs__` tuple construction is complex and visually dense, mixing comprehensions with explicit `Attribute` calls. The long parameter lists in `__init__` and `Attribute` reduce readability. The code is mostly flat with minimal deep nesting, and each line tends to perform one action, which aids comprehension. The reading flow is mostly natural, but the large block of attribute definitions could be broken down for better scannability. Overall, it is readable but could be improved by simplifying the meta-attribute construction and reducing verbosity in parameter handling.
Run 2
The code exhibits moderate readability but suffers from several issues. The class structure has a logical purpose, but the __attrs_attrs__ definition is dense and convoluted, with deeply nested tuple/generator expressions that are hard to follow. The __init__ method has an excessive number of parameters (15), making the intent unclear and the interface difficult to grasp. Method bodies are short and relatively clear, which helps, but the overall action granularity is uneven — some lines pack multiple operations while others are sparse. Nesting, especially in __attrs_attrs__, significantly hampers comprehension. Reading flow is disrupted by the lengthy parameter lists and complex data structure initialization. The code length is not overly verbose for the functionality, but conciseness does not compensate for the structural opacity. The clarity of intent is undermined by the heavy reliance on internal framework conventions without explanatory comments in the trickiest sections.
Run 3
The code is highly readable. It uses clear imports, a logical class structure, and descriptive method names with concise docstrings explaining behavior and exceptions. The action granularity is mostly one action per line, especially in __init__. The __attrs_attrs__ construction uses a tuple generator and explicit Attribute calls, which is structured though slightly verbose. Overall nesting is flat, and intent is clear.
Run 1
Code Structure: Clearly organized into imports, class metadata, initialization, and focused decorator methods. Nesting: Shallow overall; the attribute-building comprehension is the densest section. Clarity of intent: Descriptive names and useful docstrings explain ordering and decorator behavior, although external symbols and the converter lambda require additional context. Code length: Mostly justified, but repeated Attribute configuration and the long constructor make the class verbose. Action granularity: Statements generally perform one action per line; the lambda and expanded tuple comprehension are modest exceptions in complexity. Reading flow: Consistent formatting and straightforward branches support natural reading, though substantial metadata before the methods delays reaching the core behavior.
Run 2
Code Structure: The class is logically organized into metadata, initialization, and small decorator methods, although the large import block and attribute declaration add overhead. Nesting: Control flow is shallow, with simple conditionals; the tuple expansion and comprehension are somewhat denser. Clarity of intent: Descriptive names and useful docstrings explain ordering and decorator behavior, though external helpers and sentinel values require library context. Code length: The lengthy constructor and repeated Attribute arguments are verbose but mostly justified by explicit configuration. Action granularity: Each assignment and operation occupies its own line, making state changes easy to follow. Reading flow: Consistent formatting and method organization support natural reading, but substantial metadata before the methods delays reaching the core behavior.
Run 3
Code Structure: The class logically groups attribute storage, initialization, and decorator helpers, although the broad import block and lengthy metadata declaration add noise. Nesting: Methods remain shallow, with straightforward conditionals; the nested tuple construction is somewhat harder to scan. Clarity of intent: Descriptive method names and useful docstrings explain the purpose, but external symbols and specialized attrs conventions require context. Code length: Decorator methods are concise, while repeated Attribute arguments and the large constructor introduce verbosity. Action granularity: Statements generally perform one action per line, making state changes easy to follow. Reading flow: Consistent formatting and the progression from class configuration to initialization and helper methods support natural reading, though the extensive configuration delays the behavioral code.