Sample
pyint-311378c2f996-I08
Select one of ten high-readability unrelated code templates per class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.666 | 0–1; higher is more readable |
| Mi | 0.521 | 0–1; higher is more readable |
| LLOC | 28 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.467 | 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. | 1809.814 | −59.724 |
| Source linesThe number of non-empty source lines. | 65 | +26 |
| 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.504 | −6.756 |
Intercept 8.87 + feature contributions = -31.61 (log-odds).
Score = sigmoid(-31.61) = 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. | 65 | −1.265 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 56 | +1.2 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 56 | −0.864 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 84.924 | +0.566 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 64.907 | +0.497 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.054 | +0.419 |
| 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.985 | +0.066 |
Intercept 0.07 + feature contributions = 0.688 (log-odds).
Score = sigmoid(0.688) = 0.666.
| Score | 0.521 |
|---|
| Score | 28 |
|---|
Run 1
The code is generally well-structured with clear imports, a documented class, and a single method with a clear purpose. The method is mostly flat with only one level of nesting, and it uses descriptive variable names. The main issue is an irrelevant loop at the top of get_object that computes a running total but serves no purpose in the method's logic, which hurts clarity of intent. The remaining code has good action granularity and a natural reading flow, moving from date extraction to queryset filtering to the super call. The error message construction is slightly long but justified. Overall, the code is readable but could be improved by removing the dead code block.
Run 2
The code is generally readable with clear imports and logical structure. However, the presence of an unrelated loop (running_total) at the beginning of get_object is confusing and should be removed. The method is somewhat long but maintains a reasonable flow with clear comments. Nesting is flat, and intent is mostly clear, though the unused loop undermines this. Overall the code is understandable but has one significant readability issue and moderate length.
Run 3
The code is generally readable with clear imports and a well-structured class. Intent is evident from docstrings and comments. Nesting is shallow, and action granularity is mostly one action per line. However, readability is reduced by the presence of an unnecessary loop (lines computing `running_total`) that appears unrelated to the method's purpose, breaking clarity of intent and reading flow. The error-raising block is somewhat verbose and spans multiple lines, slightly disrupting flow. Some multi-line expressions (e.g., the exception message) are long but acceptable. The method could be shorter and clearer by removing the irrelevant loop. Overall, the code is logical and follows Django conventions, but the extraneous code and verbose error handling prevent a higher score.
Run 1
Code Structure: The method follows a logical sequence: extract the date, select a queryset, validate future dates, filter, and retrieve the object. However, the unrelated running_total calculation disrupts cohesion. Nesting: Shallow nesting keeps control flow easy to follow. Clarity of intent: The class docstring, method name, and comments explain the purpose well, although qs is abbreviated and several mixins and helpers are not defined in the snippet. Code length: Mostly concise, but the unused calculation and numerous unused imports add clutter. Action granularity: Statements generally perform one action each; multiline calls and error formatting remain readable. Reading flow: The main processing sequence is natural, with useful whitespace and comments, but the irrelevant loop at the start distracts from the method's purpose.
Run 2
Code Structure: The class and method are logically organized, but the unrelated running_total loop and unused imports add clutter. Nesting: Control flow is shallow, with only a simple loop and conditional; the multiline exception construction is visually dense rather than deeply nested. Clarity of intent: The docstrings, descriptive method names, and comments clearly explain date-based object retrieval, although qs is abbreviated and mixins and helper definitions are external to the snippet. Code length: Most code is appropriately concise, but the unused calculation and imports unnecessarily increase length. Action granularity: Statements generally perform one action per line, and multiline calls are formatted consistently. Reading flow: Date extraction, validation, filtering, and delegation follow a natural sequence, interrupted primarily by the irrelevant calculation at the start.
Run 3
Code Structure: The class and method are logically organized, separating date extraction, validation, filtering, and object retrieval; however, the unrelated running_total loop and unused imports add clutter. Nesting: The method remains mostly flat, with only a simple loop and conditional. Clarity of intent: Descriptive method names, a useful docstring, and comments explain the date-based lookup, but the unused calculation is distracting, and mixins and helpers are defined outside the snippet. Code length: The core logic is reasonably concise, although irrelevant code and imports unnecessarily lengthen it. Action granularity: Statements generally perform one action per line, and multiline calls make arguments easy to scan. Reading flow: The progression from URL date components to queryset selection, future-date validation, filtering, and retrieval is natural, interrupted mainly by the unrelated loop.