Sample
pyint-28b1c761299c-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.673 | 0–1; higher is more readable |
| Mi | 0.513 | 0–1; higher is more readable |
| LLOC | 25 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.633 | 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. | 62 | +24.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.509 | −6.764 |
Intercept 8.87 + feature contributions = -28.151 (log-odds).
Score = sigmoid(-28.151) = 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. | 62 | −1.159 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 53 | +1.096 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 53 | −0.795 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 84.873 | +0.565 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 61.942 | +0.456 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.053 | +0.424 |
| 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.968 | +0.066 |
Intercept 0.07 + feature contributions = 0.723 (log-odds).
Score = sigmoid(0.723) = 0.673.
| Score | 0.513 |
|---|
| Score | 25 |
|---|
Run 1
The code is generally readable with clear imports, logical structure, and good variable naming. The main method is well-organized and focused, using meaningful intermediate variables like `year`, `month`, `day`, and `lookup_kwargs`. Comments explain non-obvious behavior, and action granularity is appropriate. However, the error-raising block contains dense string formatting that interrupts flow, and the `_date_from_string` call breaks from class methods to use a standalone function, which could confuse intent. The mixin inheritance with multiple base classes may require added cognitive load, though this is a common Django pattern. Overall, the code is concise but could benefit from extracting error handling or simplifying formatting logic.
Run 2
The code is well-structured, with clear class responsibilities and logical method flow. It uses flat control flow with only one if statement, and actions are split across lines sensibly. The intent is explicit - filtering a queryset by date before delegating to the parent get_object. Comments explain non-obvious behavior without being excessive. Variable names are descriptive (qs, lookup_kwargs, year/month/day). The only minor downsides: underscores in _date_from_string and _make_single_date_lookup suggest private helpers, but this is idiomatic Django. The function is concise yet readable, combining multiple imports neatly. Overall, highly maintainable code that balances brevity with clarity.
Run 3
The code is well-structured and follows Django conventions clearly. The imports are organized. Class definition and method are logically placed. Nesting is mostly flat, with only one conditional block that handles a single case. Variable names are descriptive (year, month, day, date, qs, lookup_kwargs), making the intent clear. Comments are helpful and not excessive. However, the get_object method has multiple logical steps involving date parsing, queryset retrieval, conditional checking, filtering, and super() call, which is typical for a base class but may feel slightly dense. The method is still readable due to clear line separation and consistent formatting. The action granularity is adequate. Reading flow is natural from input extraction to final return.
Run 1
Code Structure: The class and method follow a logical sequence: extract date components, construct the date, select a queryset, validate future access, filter, and retrieve the object. Nesting: Minimal nesting, with a single conditional and no loops. Clarity of intent: The class docstring, descriptive method names, and comments clearly explain the date-based lookup; however, externally defined mixins and helpers require additional context, and 'qs' is less descriptive than 'queryset'. Code length: Appropriately concise, though several imports are unused in this snippet. Action granularity: Each statement performs a distinct action, and multiline calls improve legibility. Reading flow: Execution proceeds naturally from input preparation through validation to retrieval; the formatted error message briefly interrupts the flow but remains readable.
Run 2
Code Structure: The method is logically organized into date extraction, parsing, queryset selection, future-date validation, filtering, and object retrieval. Nesting: Control flow is shallow, with only one conditional; nested formatting adds some visual complexity. Clarity of intent: Descriptive method names, a useful class docstring, and explanatory comments make the purpose clear, though mixins and helper definitions are outside the snippet and 'qs' is abbreviated. Code length: The implementation is reasonably concise, but several imports are unused in this excerpt and the exception message occupies substantial space. Action granularity: Each statement performs a focused action, with multiline calls formatted cleanly. Reading flow: Execution follows a natural progression from URL date inputs to the final object lookup, with whitespace separating meaningful stages.
Run 3
Code Structure: The class and method are logically organized into date extraction, queryset selection, validation, filtering, and retrieval. Nesting: Only one conditional is used, keeping control flow shallow. Clarity of intent: Descriptive method names, a focused docstring, and explanatory comments make the purpose clear, although external mixins and helper functions require surrounding context, and 'qs' is somewhat abbreviated. Code length: The implementation is concise overall; multiline date parsing and exception formatting add length but remain readable. Action granularity: Each statement generally performs one action, with a straightforward conditional expression for queryset selection. Reading flow: Execution proceeds naturally from request parameters to the final object lookup. Some imports appear unused in this excerpt, adding minor visual clutter.