Sample
pyint-e997c3690094-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.186 | 0–1; higher is more readable |
| Mi | 0.416 | 0–1; higher is more readable |
| LLOC | 74 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 9.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 13 | 0–20; mean of three runs |
| BTTF | 0.33 | 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. | 122 | +48.8 |
| 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.452 | −6.677 |
Intercept 8.87 + feature contributions = -130.994 (log-odds).
Score = sigmoid(-130.994) = 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. | 123 | −3.319 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 113 | +3.171 |
| 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. | 140.976 | −2.306 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 113 | −2.172 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 141 | +1.471 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 121.901 | +1.294 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.065 | +0.312 |
Intercept 0.07 + feature contributions = -1.479 (log-odds).
Score = sigmoid(-1.479) = 0.186.
| Score | 0.416 |
|---|
| Score | 74 |
|---|
Run 1
The code has good logical organization with a clear class structure and docstring, but several formatting issues hurt readability. The constructor parameters are oddly aligned with excessive whitespace and misplaced closing parenthesis. Multiple statements are crammed onto single lines (e.g., properties without blank lines between methods, dict construction with many items on one line). The tuple unpacking in reverse() is confusing (`*info` before action). List comprehensions for url_params are awkwardly formatted with misaligned continuation lines. Some methods like `choices` setter and `value_omitted_from_data` lack proper spacing from adjacent methods. The imports are clean, and the intent is generally clear, but the inconsistent formatting, unusual line breaks, and compressed statements make the code harder to scan than necessary. Action granularity suffers where multiple assignments or context dictionary entries share lines despite ample space for one-per-line formatting.
Run 2
The code has severe readability issues. The constructor has inconsistent indentation with parameters crammed together, and many function calls are broken across lines awkwardly, e.g., reverse() with parameters oddly spaced. Multiple statements are placed on single lines, such as consecutive assignments in __init__. The __deepcopy__ method, property methods, and value_from_datadict methods lack blank lines between them, making the class difficult to scan. While some comments exist, the formatting undermines clarity. The string formatting and list comprehension in get_context are unnecessarily convoluted, mixing logical grouping with poor line breaks. Overall, the code requires significant reformatting to be readable.
Run 3
The code has a clear purpose but suffers from severe formatting issues that make it difficult to read. The __init__ method's parameters are awkwardly spaced, and lines are broken mid-expression in ways that disrupt natural reading flow. Multiple statements are crammed onto single lines (e.g., the three return statements in value_from_datadict, value_omitted_from_data, and id_for_label), and decorators lack proper spacing. Nested f-strings and tuple unpacking in get_related_url create ambiguity. Deep indentation in get_context makes the logic harder to parse, and inconsistent spacing around operators throughout adds to the noise. While variable names and comments fit Django conventions, the inconsistent formatting undermines clarity. The code structure is otherwise logical, but the presentation makes it feel rushed or corrupted. Improving line breaks, separating statements, and normalizing spacing would greatly enhance readability.
Run 1
Code Structure: A cohesive widget-wrapper class separates initialization, properties, context construction, and delegation into logical methods. Nesting: Mostly flat, with simple conditionals and no deeply nested control flow. Clarity of intent: Descriptive method and attribute names, plus explanatory comments, make the purpose clear, although framework-specific details require Django knowledge. Code length: Generally appropriate, but numerous unused imports in the snippet add clutter. Action granularity: Most statements perform one action, though multiple parameters, dictionary entries, and imported names crowded onto individual lines hinder scanning. Reading flow: Method ordering is sensible, but inconsistent spacing, awkward line breaks, and missing blank lines between some methods significantly disrupt readability.
Run 2
Code Structure: The class is logically organized into initialization, delegated properties, context construction, and widget methods, although inconsistent method spacing weakens separation. Nesting: Conditionals are shallow, and there are no deeply nested control structures. Clarity of intent: Descriptive method and attribute names, plus explanatory comments, make the wrapper's purpose clear; framework-specific dependencies require Django knowledge. Code length: Mostly concise, with straightforward delegation methods, though several imports appear unused in this snippet. Action granularity: Statements generally perform one action per line, but multiple parameters and dictionary entries crowded onto individual lines reduce scanability. Reading flow: The overall sequence is natural, but excessive inline whitespace, irregular line wrapping, and missing blank lines interrupt reading, particularly in the constructor and get_context().
Run 3
Code Structure: The class is logically organized into initialization, delegated properties, URL/context construction, and widget forwarding methods. Nesting: Shallow conditionals keep control flow easy to follow. Clarity of intent: Descriptive method and variable names, plus explanatory comments, make the wrapper's purpose clear, although Django-specific concepts require familiarity. Code length: Mostly concise, with some repetitive forwarding methods and imports unused in this snippet. Action granularity: Most statements perform one action, but multiple parameters and dictionary entries crowded onto single lines reduce scanability. Reading flow: Inconsistent spacing, awkward line wrapping, and missing blank lines between some methods disrupt otherwise natural progression. Overall, the logic is readable, but formatting significantly weakens presentation.