Sample
pyint-7acc041981bf-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.43 | 0–1; higher is more readable |
| Mi | 0.463 | 0–1; higher is more readable |
| LLOC | 74 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 0–20; mean of three runs |
| BTTF | 0.407 | 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. | 5514.733 | −181.986 |
| Source linesThe number of non-empty source lines. | 144 | +57.6 |
| 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.464 | −6.695 |
Intercept 8.87 + feature contributions = -122.211 (log-odds).
Score = sigmoid(-122.211) = 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. | 145 | −4.098 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 135 | +3.932 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 135 | −2.677 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 143.795 | +1.6 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.938 | +0.598 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.065 | +0.31 |
| 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. | 86.979 | −0.019 |
Intercept 0.07 + feature contributions = -0.283 (log-odds).
Score = sigmoid(-0.283) = 0.43.
| Score | 0.463 |
|---|
| Score | 74 |
|---|
Run 1
The code is well-structured and readable. It follows a logical organization with clear separation of concerns, using a single class with focused methods. Nesting is minimal, with only one small conditional inside a method. The intent of the class and each method is clear, with descriptive names and a helpful docstring. Code length is appropriate for the functionality, and actions are mostly one per line, improving readability. The reading flow is natural, with related properties grouped together and a logical progression from initialization to context building to data handling. Minor deductions for slightly verbose imports and a couple of long lines, but overall the code is highly readable.
Run 2
The code is well-structured with clear separation of concerns, following Django widget patterns. The class has a single responsibility and methods are logically organized. Nesting is minimal with only one level in get_context's conditional blocks. Intent is clear through descriptive method names and docstrings. However, some sections could be more concise - the __init__ method has multiple boolean logic assignments that could be extracted for clarity. The get_context method builds URL parameters in a slightly convoluted way using a generator expression. Action granularity is mostly good with one action per line, though the URL parameter construction packs multiple operations. The reading flow is natural and the code is maintainable, though the deepcopy method's purpose could be clearer. Overall, this is readable Django code that follows established patterns well, with minor opportunities for simplification.
Run 3
The code is generally well-structured and readable. It uses clear class and method names, logical grouping of related functionality, and appropriate docstrings. Nesting is minimal, with only one level in get_context's conditional blocks. The get_context method builds a clean context dictionary, and action granularity is mostly one action per line. However, a few aspects reduce readability: the __init__ method has many parameters and some inline comments that explain 'why' but can feel verbose; the supported/cascade logic is slightly dense; and the get_context method is a bit long due to URL parameter construction. The multi-line string formatting in get_related_url is slightly obscure. Overall, the code is maintainable and understandable, but could be improved by extracting some helper methods or simplifying conditional logic.
Run 1
Code Structure: Well-organized class with distinct initialization, delegation, URL generation, and context-building methods. Nesting: Shallow conditionals and no deeply nested control flow make scanning easy. Clarity of intent: Descriptive method names, permission flags, and targeted comments explain most behavior, though framework-specific metadata, the undefined-in-snippet AutocompleteMixin, and the narrow class docstring require additional context. Code length: Mostly concise; delegation methods are appropriate wrapper boilerplate, but unused imports add clutter. Action granularity: Statements generally perform one action per line, with multiline expressions formatted clearly. Reading flow: Methods follow a sensible progression, and get_context proceeds naturally from metadata extraction to context construction and conditional URLs. Mixed string-formatting styles and some dense framework expressions slightly reduce consistency.
Run 2
Code Structure: Well-organized class with separate initialization, delegation, URL generation, and context-building methods. Nesting: Shallow conditionals and a simple comprehension keep complexity low. Clarity of intent: Descriptive method names, permission flags, and explanatory comments make the wrapper's purpose clear, although Django-specific conventions and placeholders require framework knowledge. Code length: Mostly concise; repetitive forwarding methods are justified by the wrapper pattern, while several unused imports add clutter. Action granularity: Statements generally perform one action per line, with readable multiline calls and dictionaries. Reading flow: Methods progress naturally from setup to properties and rendering support, though the local import and lengthy initializer/context method slightly interrupt the flow.
Run 3
Code Structure: Well-organized class with initialization, delegated properties, URL generation, and context construction separated into focused methods. Nesting: Shallow conditionals and no deeply nested control flow make execution easy to follow. Clarity of intent: Descriptive method names, permission flags, and explanatory comments communicate the widget wrapper's purpose, though abbreviated names such as rel and info and framework-specific conventions require familiarity. Code length: Mostly concise, with some unavoidable delegation boilerplate and a relatively long initializer and context method; several unused imports add noise. Action granularity: Statements generally perform one action per line, while compound permission expressions remain manageable. Reading flow: Methods follow a natural progression, and consistent formatting helps scanning. Minor distractions include the local import, mixed string-formatting styles, and the unexplained __fk__ placeholder.