Sample
pyint-2f6dce5cc0c4-I01
Remove comments and docstrings
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.333 | 0–1; higher is more readable |
| Mi | 0.642 | 0–1; higher is more readable |
| LLOC | 23 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.608 | 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. | 1647.155 | −54.356 |
| Source linesThe number of non-empty source lines. | 57 | +22.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.406 | −6.61 |
Intercept 8.87 + feature contributions = -29.296 (log-odds).
Score = sigmoid(-29.296) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 57 | +1.234 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 58 | −1.017 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 57 | −0.887 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 56.895 | +0.385 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.07 | +0.258 |
| 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. | 84.948 | +0.067 |
Intercept 0.07 + feature contributions = -0.693 (log-odds).
Score = sigmoid(-0.693) = 0.333.
| Score | 0.642 |
|---|
| Score | 23 |
|---|
Run 1
The code is generally readable with a clear logical structure and flat nesting. It follows Django CBV conventions well. Clarity of intent is mostly good, though the function `_date_from_string` and `_make_single_date_lookup` are helpers whose existence is assumed. The use of comments that are just empty lines is redundant and slightly hurts flow. The try/except or validation for missing year/month/day is absent, but that may be handled in mixins. Action granularity is good — one action per line. The length is appropriate; no unnecessary verbosity. Reading flow is natural with a clear sequence: parse date, check allow_future, filter queryset, return object. Minor deductions for blank comment lines and reliance on external helper functions not shown. Overall, it is readable and maintainable.
Run 2
The code is generally readable with clear variable names, logical flow, and a single action per line in most cases. The class inheritance is understandable but somewhat crowded. Nesting is minimal. However, there are several blank space lines and a multi-line method chain that slightly disrupt flow. The intent is mostly clear, but the error message construction is complex and the reliance on implicit class attributes (YearMixin etc.) may confuse readers unfamiliar with Django mixins. Overall, readable but not effortlessly so.
Run 3
The code is generally well-structured and readable, with a clear purpose (retrieving a date-based object) and good use of Django's class-based view patterns. The method is concise and follows a logical flow: get date components, build the date, validate future dates, filter the queryset, and delegate to the parent. Nesting is minimal, and action granularity is mostly one operation per line, especially in the date construction section. However, readability is slightly hampered by the long, multi-line error message construction and the dense string formatting with dictionary entries. The empty comment lines and isolated hash comments suggest leftover scaffolding or missing documentation, which adds minor noise. Variable names are descriptive, and the overall intent is unambiguous. A few small refactors—extracting the error message building into a helper method or simplifying the comments—would improve clarity further.
Run 1
Code Structure: The method follows a logical sequence: extract date components, construct a date, select a queryset, validate future-date access, filter, and retrieve the object. Nesting: Only one conditional keeps control flow shallow, although the exception formatting is visually nested. Clarity of intent: Descriptive method names communicate purpose well; 'qs' is conventional but less explicit than 'queryset', and inherited helpers require external context. Code length: The implementation is reasonably concise, but unused imports in this snippet and excessive blank lines add clutter. Action granularity: Each statement performs a distinct action, with multiline expressions improving scanability. Reading flow: Execution proceeds naturally from input preparation to validation and retrieval, though irregular whitespace interrupts the flow.
Run 2
Code Structure: The method is logically organized into date extraction, queryset selection, future-date validation, filtering, and object retrieval, although several imports are unused in this snippet. Nesting: Control flow is shallow, with only one conditional; the exception construction adds visual indentation without complex logic. Clarity of intent: Descriptive method and variable names make the date-based lookup clear, but external mixins and helper functions require surrounding context. Code length: The implementation is reasonably concise, though excessive blank lines and a lengthy error-message construction add visual bulk. Action granularity: Each statement performs a distinct step; the conditional queryset assignment is compact and understandable. Reading flow: Execution follows a natural sequence, but inconsistent whitespace interrupts scanning.
Run 3
Code Structure: The method is logically organized into date extraction, queryset selection, future-date validation, filtering, and object retrieval. Nesting: A single conditional keeps control flow shallow; multiline calls add visual indentation without complex nesting. Clarity of intent: Descriptive method and variable names communicate the date-based lookup, although inherited mixins and helper implementations are absent, and 'qs' is abbreviated. Code length: The implementation is reasonably concise, but excessive blank lines and unused imports in the shown snippet create clutter. Action granularity: Most lines perform one action; the conditional queryset assignment remains straightforward. Reading flow: Operations follow a natural sequence, though unexplained whitespace interrupts continuity and the elaborate exception formatting slightly slows reading.