Sample
pyint-7842407f842f-I11
Split eligible integer literals into pairs of short-named intermediate 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 | 17.33 | 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 highly readable with clear structure, shallow nesting, and explicit intent. The class and method names communicate purpose well, and the docstrings provide helpful context. Each logical step (parsing the date, building the queryset, filtering) appears in distinct blocks with minimal nesting. Most lines perform a single action, and the reading flow is natural: extract URL params, construct date, validate future-dated requests, then apply filters. Minor deductions: the long error message string breaks up the flow slightly, and the intermediate queryset variable assignment could be more compact. Overall, consistent Django style, clear comments, and separation of concerns contribute to a strong readability score.
Run 3
The code is well-structured and readable. Imports are organized, the class hierarchy is clear, and the method has a single, focused purpose. Nesting is minimal—only one conditional with no deep indentation. Intent is clearly documented via docstrings and comments. The method is concise yet descriptive, avoiding unnecessary verbosity. Action granularity is appropriate: each logical step (extracting date parts, creating date, filtering queryset) occupies its own line or small block. Reading flow is natural, progressing from date parsing to validation to filtering and delegation. Minor deductions: the error message construction with string formatting and translation is somewhat dense, and the comment about passing queryset could be slightly clearer. Overall, this is exemplary Django view code that balances clarity and conciseness effectively.
Run 1
Code Structure: The class and method are logically organized, separating date parsing, queryset selection, validation, filtering, and retrieval. Nesting: Minimal nesting keeps control flow easy to follow; the multiline exception is visually dense but manageable. Clarity of intent: The docstrings, descriptive method names, and comments explain the purpose well, although undefined mixins and helper functions require external context, and 'qs' is less descriptive than 'queryset'. Code length: Mostly concise, with some verbose exception formatting and imports unused in the provided snippet. Action granularity: Each statement generally performs one clear action, and multiline calls are formatted consistently. Reading flow: Execution follows a natural sequence from URL date extraction to object retrieval, with whitespace separating conceptual steps. Overall, the code is highly readable, with minor friction from framework-specific dependencies and the lengthy error construction.
Run 2
Code Structure: The method is logically organized into date extraction, parsing, queryset selection, validation, filtering, and retrieval. Nesting: Control flow is shallow, with only one conditional; the multiline exception formatting adds visual complexity but not deeply nested logic. Clarity of intent: Descriptive method names, the class docstring, and comments make the purpose clear, though 'qs' is abbreviated and the mixins and helper are not defined in the snippet. Code length: The implementation is reasonably concise, but several imports are unused here and the formatted error message occupies substantial space. Action granularity: Statements generally perform one action each, with a straightforward conditional expression for queryset selection. Reading flow: Execution proceeds naturally from URL date components to the final object lookup, with whitespace separating meaningful stages.
Run 3
Code Structure: The class and method are logically organized, separating date parsing, queryset selection, future-date validation, filtering, and object retrieval. Nesting: Control flow is shallow, with only one conditional; nested formatting adds minor visual complexity. Clarity of intent: Descriptive method names, the class docstring, and comments make the purpose clear, although the abbreviated variable 'qs' and externally defined mixins/helpers require some context. Code length: The method is reasonably concise, but unused imports in this excerpt and verbose exception formatting add bulk. Action granularity: Most statements perform one clear action, and multiline calls improve readability. Reading flow: Execution proceeds naturally from URL date extraction to validation and retrieval, with delegation to the superclass providing a clean ending.