Sample
pyint-ac92533db2e3-SRC
Unmodified source class
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 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.67 | 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 a clear structure and logical organization, aided by docstrings and meaningful variable names. It follows Django conventions and separates concerns via mixins. However, readability is slightly reduced by a long get_object method that performs several tasks — extracting date components, performing future-date validation, filtering the queryset, and delegating to super — within a single method. The nesting is modest, with one conditional and no deep indentation, which is good. The try/except-style flow and the multiline string formatting in the Http404 message add some visual clutter, and the comment precedes a block of operations rather than being consistently applied. Overall, the code is understandable but could benefit from extracting the date parsing and validation into helper methods to improve action granularity and reading flow.
Run 2
The code is well-structured and follows Django conventions clearly. The class has a single focused method with a clear purpose, minimal nesting, and well-named intermediate variables like 'year', 'month', 'day', and 'date'. Comments explain the non-obvious parts, such as the queryset filtering and 404 logic. Each action is generally on its own line, keeping granularity appropriate. The reading flow is logical: extract date components, validate the date, filter the queryset, then delegate. Minor deductions: the conditional queryset assignment and the long error message string slightly reduce conciseness, and the class's reliance on mixins not shown here makes it slightly less self-contained. Overall, it is highly readable with no tangled logic.
Run 3
The code is generally well-structured and readable. It uses clear variable names (`year`, `month`, `day`, `qs`) and logical imports. The main method `get_object` has minimal nesting—only two conditional branches—and each major step (extract date, build queryset, check future, filter, delegate) is separated by blank lines and comments, aiding comprehension. The docstrings clearly state intent, and the error message is descriptive. However, some minor aspects reduce readability: the conditional queryset assignment (`qs = ... if queryset is None else queryset`) is compact but slightly less clear than an if/else block; the `_make_single_date_lookup` and `_date_from_string` helper methods are referenced without definition, which could confuse someone reading this file in isolation. Overall, the code follows Django conventions, keeps actions mostly one-per-line, and flows naturally from parsing input to returning the object, though it could be marginally improved with explicit helper context or a small refactor of the queryset logic.
Run 1
Code Structure: The class and method are logically organized into date parsing, queryset selection, future-date validation, filtering, and retrieval. Nesting: Control flow is shallow, with one conditional and no nested branches; multiline formatting adds visual depth but not logical complexity. Clarity of intent: Descriptive names, a useful class docstring, and explanatory comments make the purpose clear, although inherited mixins and helper methods require external context. Code length: The method is reasonably concise; the lengthy error construction and several unused imports in this excerpt add some clutter. Action granularity: Statements generally perform one action each, with clear intermediate variables. Reading flow: Execution proceeds naturally from request date extraction to object retrieval, though the multiline date conversion and exception message briefly interrupt the flow.
Run 2
Code Structure: The method is logically organized into date extraction, queryset selection, future-date validation, filtering, and object retrieval. Nesting: Control flow is shallow, with only one conditional block. Clarity of intent: Descriptive method names, a useful class docstring, and explanatory comments make the purpose clear, though mixins and helper definitions are absent from the snippet and 'qs' is abbreviated. Code length: The implementation is appropriately concise; several unused imports add clutter within this excerpt, and verbose error formatting slightly expands the method. Action granularity: Statements generally perform one action each, while multiline calls and dictionary formatting remain easy to follow. Reading flow: Execution follows a natural progression from URL date components to the requested object, with whitespace separating meaningful stages.
Run 3
Code Structure: The method follows a logical sequence: extract date components, construct the date, choose a queryset, enforce future-date restrictions, filter, and delegate retrieval. Nesting: Control flow is shallow, with only one conditional; the multiline exception formatting adds visual depth but little complexity. Clarity of intent: Descriptive method names, a class docstring, and targeted comments explain the purpose well, although undefined mixins and helpers require external context, and 'qs' is less descriptive than 'queryset'. Code length: The implementation is appropriately concise, though several imports are unused in this excerpt. Action granularity: Each statement performs a distinct operation, with long calls and mappings split clearly across lines. Reading flow: The top-to-bottom progression is natural and easy to follow; the verbose error-message construction slightly interrupts the main retrieval flow.