Sample
pyint-a395f48bfe4a-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.439 | 0–1; higher is more readable |
| Mi | 0.44 | 0–1; higher is more readable |
| LLOC | 20 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 12.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14.33 | 0–20; mean of three runs |
| BTTF | 0.527 | 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. | 1032 | −34.056 |
| Source linesThe number of non-empty source lines. | 27 | +10.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.546 | −6.818 |
Intercept 8.87 + feature contributions = -21.204 (log-odds).
Score = sigmoid(-21.204) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.059 | +0.372 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 27 | −0.199 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 27 | +0.197 |
| 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. | 83.964 | +0.109 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 28 | +0.045 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 26.918 | −0.034 |
Intercept 0.07 + feature contributions = -0.244 (log-odds).
Score = sigmoid(-0.244) = 0.439.
| Score | 0.44 |
|---|
| Score | 20 |
|---|
Run 1
The code has a clear structure with organized imports and a properly defined PermissionManager class, which helps in understanding its Django context. The 'get_by_natural_key' method is logically named and mostly readable. However, the inclusion of a factorial calculation loop (lines 18-19) in the middle of a database lookup method is confusing and unrelated, severely hurting clarity of intent and reading flow. This unnecessary code also increases length. While nesting is minimal and action granularity is mostly one action per line, the misplaced loop lowers the overall readability. Removing that block would raise the score to around 16-18.
Run 2
The code imports are overly broad and ambiguous (e.g., `auth`, `models`, `EmptyManager` unused), bloating the file and obscuring actual dependencies. The `PermissionManager` class has a confusing, unrelated `factorial` loop in `get_by_natural_key` that serves no purpose, severely hurting clarity. Nesting is moderate—the `ContentType` call is nested but acceptable—yet the inclusion of dead logic makes it seem more tangled. Action granularity is generally fine, with one action per line for the important calls, but the pointless loop adds noise. Reading flow suffers due to the unexplained calculation and the lack of any comment or docstring. Overall structure is just a class with one method on top of unused imports, failing to demonstrate clean organization or clear intent.
Run 3
The code is generally readable due to clean imports, standard Django patterns, and clear method naming. However, the unnecessary factorial loop (lines 18-20) is unrelated to the method's purpose, adds clutter, and reduces clarity of intent. The core logic is simple and well-nested at only one level, with a single action per line. The return statement is logically structured, though the nested `db_manager` call makes it slightly denser. Overall, the code is concise except for the extraneous loop, and the reading flow is natural except for that detour. Removing the loop would raise the score to near-perfect readability.
Run 1
Code Structure: Imports and a small manager class provide logical organization, but numerous unused imports add clutter. Nesting: Shallow method and loop nesting is easy to follow; the nested query call remains manageable. Clarity of intent: Class and method names clearly indicate permission lookup by natural key, but the unused factorial calculation is unrelated and confusing. Code length: The lookup is concise, while unused imports and the factorial loop unnecessarily lengthen the snippet. Action granularity: Each statement performs one main action, and the query arguments are clearly separated across lines. Reading flow: Formatting and indentation support a natural top-to-bottom flow, but the irrelevant calculation interrupts the path from method entry to the returned lookup.
Run 2
Code Structure: Imports, class, and method are logically organized, but many unused imports and an unrelated factorial calculation add clutter. Nesting: Shallow control flow is easy to follow; the nested lookup in the return expression is manageable. Clarity of intent: Descriptive Django API names make the permission lookup clear, but the unused factorial computation obscures the method's purpose. Code length: The actual lookup is concise, while unnecessary imports and calculations inflate the snippet. Action granularity: Each statement performs a distinct action, and the multiline return expression is sensibly formatted. Reading flow: The overall top-to-bottom flow is natural, but the irrelevant loop interrupts the transition from method declaration to lookup.
Run 3
Code Structure: Imports, class, and method are logically organized, but numerous unused imports and an unrelated factorial calculation add clutter. Nesting: Shallow overall, with only a simple loop and a nested lookup call. Clarity of intent: The method name and return statement clearly indicate a natural-key lookup, but the unused factorial calculation obscures that purpose. Code length: The core lookup is concise; unnecessary imports and computation make the snippet longer than needed. Action granularity: Each statement performs one clear action, and the multiline call is formatted cleanly. Reading flow: Conventional Django structure and indentation support easy scanning, but the irrelevant loop interrupts the natural progression to the lookup.