Sample
pyint-57be9ae28c30-I08
Select one of ten high-readability unrelated code templates per class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.424 | 0–1; higher is more readable |
| Mi | 0.463 | 0–1; higher is more readable |
| LLOC | 77 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.33 | 0–20; mean of three runs |
| BTTF | 0.361 | 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. | 5636.474 | −186.004 |
| Source linesThe number of non-empty source lines. | 147 | +58.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.464 | −6.697 |
Intercept 8.87 + feature contributions = -125.03 (log-odds).
Score = sigmoid(-125.03) = 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. | 148 | −4.204 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 138 | +4.036 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 138 | −2.746 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 146.773 | +1.642 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.926 | +0.598 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.065 | +0.315 |
| 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.953 | −0.018 |
Intercept 0.07 + feature contributions = -0.306 (log-odds).
Score = sigmoid(-0.306) = 0.424.
| Score | 0.463 |
|---|
| Score | 77 |
|---|
Run 1
The code is well-structured with clear class and method organization, following Django widget wrapper conventions. Nesting is minimal, with flat conditional blocks and no deeply nested logic. Intent is clear: wrapping a widget to add related object admin actions. Code length is appropriate for the functionality, though some imports (uuid, urlencode, etc.) appear unused, and the `media` property contains a dead-code calculation (`total_score`, `average_score`) that should be removed. Action granularity is good—one logical action per line, with contextual assignments grouped. Reading flow is natural, moving from initialization to context building to value handling. Minor deductions: unused imports and the dead `media` code slightly reduce clarity. The `__init__` logic with the `AutocompleteMixin` check is slightly terse but understandable with Django knowledge. Overall, highly readable with minor cleanliness improvements possible.
Run 2
The code is well-structured and readable. It uses a clear class with logical property and method definitions, and the constructor is organized into sensible, commented sections. Nesting is minimal, with only a few conditional statements, and the code largely maintains a flat structure. Clarity of intent is strong—method and variable names are descriptive, and the docstring and inline comments explain non-obvious logic. While the get_context method is somewhat long, it is broken into logical blocks. Action granularity is generally one action per line, though a few multi-step lines like url_params construction are slightly dense. The reading flow is natural and consistent with Django conventions. Minor deductions for the irrelevant scoring calculations in the media property and some long lines, but overall readability is high.
Run 3
The code is generally well-structured and readable. It follows Django conventions with clear separation of concerns. The __init__ method clearly initializes widget attributes, and the get_context method builds context logically. There is minimal nesting and each action is on its own line. However, there are a few issues: an unused import (URLValidator, json, etc.) clutters the top, and the 'media' property contains an irrelevant calculation (total_score, number_of_scores, average_score) that serves no purpose and should be removed. The '__deepcopy__' method is slightly unclear without a comment. The long URL string formatting in get_related_url could benefit from a named pattern for clarity. Overall, the code is concise and maintainable, but the extraneous variables and imports reduce clarity.
Run 1
Code Structure: Clearly organized into initialization, properties, context construction, and widget delegation. Nesting: Shallow conditionals and a straightforward comprehension keep complexity low. Clarity of intent: Descriptive method names and explanatory comments communicate the wrapper's purpose, but unrelated score calculations in media distract, and AutocompleteMixin is not defined or imported in the snippet. Code length: Mostly justified, although unused imports and dead calculations add unnecessary clutter. Action granularity: Statements generally perform one action per line; multiline expressions are formatted cleanly. Reading flow: Methods follow a natural progression, and context assembly is easy to trace, though dense framework-specific attribute chains and repeated permission handling require some Django familiarity.
Run 2
Code Structure: Well-organized class with distinct initialization, properties, context construction, and delegation methods. Nesting: Shallow conditionals and straightforward methods make control flow easy to follow. Clarity of intent: Descriptive names and useful comments explain permission handling, though the docstring understates the wrapper's functionality. Unrelated score calculations in the media property introduce confusion, and AutocompleteMixin is not defined or imported in the snippet. Code length: Mostly appropriate, but unused imports and dead calculations add unnecessary clutter. Action granularity: Statements generally perform one action per line; multiline expressions are formatted clearly. Reading flow: Methods follow a logical progression, and context construction is readable, although Django-specific metadata access and mixed string-formatting styles add some cognitive overhead.
Run 3
Code Structure: Logically organized into a wrapper class with focused initialization, context construction, and delegation methods. Nesting: Shallow conditionals and a straightforward comprehension keep complexity low. Clarity of intent: Descriptive method and attribute names explain most behavior, but the unrelated, unused score calculations in media are distracting; Django-specific conventions require framework knowledge. Code length: Generally concise, although unused imports and redundant calculations add clutter. Action granularity: Statements typically perform one action per line, with multiline expressions formatted clearly. Reading flow: Consistent formatting and method grouping support natural reading, though the long initializer and context dictionary require some scanning, and the docstring understates the wrapper's broader functionality.