Sample
pyint-ec6345afcc3b-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.177 | 0–1; higher is more readable |
| Mi | 0.038 | 0–1; higher is more readable |
| LLOC | 25 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 12.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14.67 | 0–20; mean of three runs |
| BTTF | 0.523 | 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. | 1668.406 | −55.057 |
| Source linesThe number of non-empty source lines. | 51 | +20.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.496 | −6.744 |
Intercept 8.87 + feature contributions = -32.532 (log-odds).
Score = sigmoid(-32.532) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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. | 175.981 | −3.789 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 176 | +2.035 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 51 | −0.769 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 43 | +0.75 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 43 | −0.566 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.053 | +0.43 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 50.96 | +0.302 |
Intercept 0.07 + feature contributions = -1.536 (log-odds).
Score = sigmoid(-1.536) = 0.177.
| Score | 0.038 |
|---|
| Score | 25 |
|---|
Run 1
The code has decent logical structure with clear sectioning and helpful comments, but readability is hampered by inconsistent formatting and misaligned indentation. The nested conditional within get_object adds moderate complexity but remains manageable. Intent is mostly clear, especially with comments explaining the date filtering logic. However, the oddly spaced function calls and string interpolation blocks disrupt reading flow and appear disorganized. The code length is appropriate for its purpose, but some lines contain multiple actions or awkward line breaks that violate one-action-per-line principle. The imported view classes are wrapped unnecessarily across multiple lines, and the error message construction has strange spacing. Overall, the code is functional and understandable but needs formatting cleanup and whitespace normalization to improve readability.
Run 2
The code has a clear purpose and follows Django patterns, but suffers from readability issues. The imports are oddly formatted with excessive whitespace and mixed line breaks. The get_object method is long and combines multiple responsibilities (date parsing, queryset filtering, error handling). The _date_from_string call has awkward, inconsistent parameter alignment, and the Http404 exception is deeply nested with confusing string formatting and alignment. While the overall structure is logical, the excessive spacing and misaligned formatting disrupt the natural reading flow.
Run 3
The code is generally structured and readable, but several formatting issues and over-compressed lines hurt clarity. Imports are logically organized, although some have awkward spacing. The class and method have clear purposes and docstrings. Nesting is shallow, with only one conditional block. However, 'action granularity' and 'reading flow' suffer significantly: the `_date_from_string` call, the `raise Http404` block, and the translation string formatting are all cramped onto single lines with odd indentation. This makes the code harder to scan and debug. The `qs` reassignment pattern is clear, but the `if queryset is None` logic, while concise, slightly reduces clarity. Overall, the code is understandable but would benefit from line breaks and better spacing to improve readability.
Run 1
Code Structure: The class and method are logically organized around parsing a date, validating it, filtering a queryset, and retrieving an object. Nesting: Shallow nesting keeps the main control path easy to follow, though the exception construction is visually cluttered. Clarity of intent: Descriptive method names, a useful docstring, and comments explain the purpose; external mixins and helpers require additional context. Code length: The implementation is reasonably concise, with some verbose error formatting and comments. Action granularity: Most statements perform one action, but two date arguments share a line and compressed import formatting reduces scanability. Reading flow: The processing sequence is natural, but inconsistent spacing, crowded parentheses, and poorly aligned dictionary entries interrupt reading.
Run 2
Code Structure: The class and method are logically organized, separating date extraction, future-date validation, queryset filtering, and object retrieval. Nesting: Control flow is shallow, with only one conditional, although the exception expression is visually cumbersome. Clarity of intent: Descriptive method names, a useful docstring, and explanatory comments make the purpose clear; helper functions and mixins require external context. Code length: The implementation is reasonably concise, though some comments repeat what the code already conveys. Action granularity: Most statements perform one action, but crowded argument and formatting lines undermine visual separation. Reading flow: Execution follows a natural sequence, but inconsistent spacing, compressed imports, and misaligned arguments interrupt scanning.
Run 3
Code Structure: The class and method are logically organized around retrieving an object for a requested date, although several dependencies are not defined in the snippet. Nesting: Control flow is shallow, with only one conditional; the multiline exception construction adds visual complexity. Clarity of intent: Descriptive method names, a useful docstring, and explanatory comments make the purpose clear. Code length: The implementation is reasonably concise, though the exception formatting and some comments are verbose. Action granularity: Most lines perform one action, but inconsistent formatting places multiple arguments and closing delimiters on the same line. Reading flow: Execution proceeds naturally from date extraction to validation, filtering, and retrieval. Irregular spacing in imports, date arguments, and the error message significantly interrupts scanning.