Sample
pyint-d0b4cf6406f0-I01
Remove comments and docstrings
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.167 | 0–1; higher is more readable |
| Mi | 0.307 | 0–1; higher is more readable |
| LLOC | 73 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.399 | 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. | 5500.479 | −181.516 |
| Source linesThe number of non-empty source lines. | 141 | +56.4 |
| 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.432 | −6.648 |
Intercept 8.87 + feature contributions = -122.894 (log-odds).
Score = sigmoid(-122.894) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 141 | +4.14 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 142 | −3.991 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 141 | −2.815 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 140.795 | +1.558 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.071 | +0.25 |
| 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.972 | −0.019 |
Intercept 0.07 + feature contributions = -1.611 (log-odds).
Score = sigmoid(-1.611) = 0.167.
| Score | 0.307 |
|---|
| Score | 73 |
|---|
Run 1
The code is well-structured and follows Django conventions closely, making it highly readable for experienced Django developers. The class has a clear single responsibility: wrapping related-field widgets in admin forms. Methods are logically organized and named consistently. Nesting is minimal—only simple conditional blocks without deep indentation. Intent is clear due to descriptive variable names (e.g., can_add_related, related_field_name) and method names (get_related_url, value_from_datadict). Action granularity is good, with one operation per line in most cases. The __init__ method is somewhat long but unavoidable given the number of parameters and configuration flags. Minor deductions: the get_context method has several local variable assignments before building the context dict, slightly reducing flow, and the string formatting for URL params could be more concise with urlencode (already imported but unused). Overall, this is production-quality Django code that prioritizes clarity and maintainability.
Run 2
The code is generally well-structured and readable, with clear method separation and consistent naming. It uses a logical flow in __init__ and get_context, and nesting is shallow—mostly one or two levels. Intent is mostly clear, though some attributes like can_change_related depend on subtle conditions (e.g., isinstance checks) that could be made more explicit. Action granularity is good, with one operation per line in most places. The main drawbacks are a few blank lines that don't add clarity and some magic strings like 'available-source' that could be constants. Imports are extensive but standard for Django. Overall, the code is readable, with minor opportunities for comments on why certain conditions are checked.
Run 3
The code is generally well-structured with clear separation of concerns. The class has a logical organization, with properties and methods grouped together. Nesting is relatively flat, with only one level of conditional blocks in get_context. The intent is mostly clear, though some complex logic in __init__ could benefit from extraction into helper methods. Action granularity is mostly one action per line, improving readability. The reading flow is natural, progressing from initialization through properties to methods. Some minor issues: the __init__ method handles multiple unrelated concerns (setting widget attributes, checking permissions, handling cascade), the get_context method builds context imperatively, and some magic strings like '__fk__' reduce clarity. The unused imports also slightly detract from readability. Overall, it's readable Django code with good structure but room for improvement in method decomposition and clarity of intent.
Run 1
Code Structure: Well-organized class with separate methods for initialization, context construction, and widget delegation. Nesting: Shallow conditionals and no deeply nested control flow make it easy to scan. Clarity of intent: Descriptive method names and permission flags communicate purpose, though terse names such as rel and info, Django-specific internals, and the undefined-in-snippet AutocompleteMixin require outside context. Code length: Mostly concise; delegation methods are appropriate, but numerous unused imports and excessive blank lines add clutter. Action granularity: Statements generally perform one action per line, with readable multiline expressions and dictionary entries. Reading flow: Progresses naturally from setup through properties and rendering to delegation, although unexplained permission constraints and mixed URL-formatting styles slightly interrupt comprehension.
Run 2
Code Structure: Well organized into initialization, delegated properties, URL generation, context construction, and widget forwarding methods. Nesting: Shallow conditionals and a straightforward comprehension keep complexity low. Clarity of intent: Descriptive method names and permission flags explain most behavior, although framework-specific details, abbreviated names such as rel and info, and the undefined-in-snippet AutocompleteMixin require external context. Code length: Generally concise; repetitive delegation methods serve a clear purpose, but several unused imports and excessive blank lines add noise. Action granularity: Statements mostly perform one action each, and multiline expressions improve scanning. Reading flow: Progresses naturally from configuration to rendering support and delegation, though the lengthy get_context method and unexplained deletion restrictions slightly interrupt comprehension.
Run 3
Code Structure: The class is logically organized into initialization, delegated properties, URL generation, context construction, and widget forwarding methods. Nesting: Control flow stays shallow, with straightforward conditionals and no deeply nested blocks. Clarity of intent: Descriptive method names and permission flags make the wrapper's purpose clear, although Django-specific concepts, the undefined-in-snippet AutocompleteMixin, and terse names such as rel and info require background knowledge. Code length: Most methods are concise; the larger initializer and context builder remain manageable, but unused imports and excessive blank lines add clutter. Action granularity: Statements generally perform one action per line, and multiline calls and dictionaries are easy to scan. Reading flow: The progression from setup to rendering and delegation is natural. Inconsistent whitespace, mixed string-formatting styles, and missing explanatory documentation slightly reduce readability.