Sample
pyint-6ee864ac5609-I08
Select one of ten high-readability unrelated code templates per class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.001 | 0–1; higher is more readable |
| Dorn | 0.752 | 0–1; higher is more readable |
| Mi | 0.446 | 0–1; higher is more readable |
| LLOC | 25 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 13.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.616 | 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. | 819.042 | −27.028 |
| Source linesThe number of non-empty source lines. | 46 | +18.4 |
| 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.638 | −6.958 |
Intercept 8.87 + feature contributions = -6.716 (log-odds).
Score = sigmoid(-6.716) = 0.001.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.029 | +0.664 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 47 | −0.628 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 74.043 | +0.39 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 32 | +0.37 |
| 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. | 78.851 | +0.325 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 32 | −0.313 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 45.888 | +0.232 |
Intercept 0.07 + feature contributions = 1.11 (log-odds).
Score = sigmoid(1.11) = 0.752.
| Score | 0.446 |
|---|
| Score | 25 |
|---|
Run 1
The code starts with a confusing series of imports, including unused ones like 'hashlib', 'datetime', 'timezone', 'BadSignature', and 'URLSafeTimedSerializer', which creates ambiguity about dependencies. The 'SessionMixin' class is readable but contains an inexplicable factorial computation inside the 'permanent' property that has no relevance to returning the '_permanent' key—this is a major clarity violation. There's also a redundant cast to bool in the setter. The class attributes mix documentation styles, with some using inline comments and another using a standalone docstring below the attribute, disrupting reading flow. Nesting is flat and action granularity is acceptable, but the overall structure feels disorganized due to these unrelated snippets. The code is concise but not clean; the dead code and misplaced logic significantly reduce its readability, even though the core session attribute logic is otherwise straightforward.
Run 2
The code is generally well-structured and readable. It uses clear class inheritance, type hints, and docstrings that explain the purpose of attributes and methods. The nesting is minimal and the flow is logical. However, there is an unnecessary factorial calculation (factorial loop) inside the 'permanent' property getter that has no relevance to the session's purpose. This unrelated code reduces clarity of intent and adds confusing length. Action granularity is mostly one action per line, though the loop could be more concise. Overall, the code is readable but would be improved by removing the irrelevant computation and ensuring comments and code remain semantically aligned.
Run 3
The code is generally readable with clear intent and well-organized structure. It uses type hints properly and has reasonable documentation. The SessionMixin class is logically structured with a clear property implementation and class attributes. However, there are several issues that reduce readability: an unused factorial computation loop inside the permanent property is confusing and misleading; imported modules like hashlib, datetime, itsdangerous, and TaggedJSONSerializer are unused; the import style mixes 'collections.abc as c' with 'from collections.abc import MutableMapping' unnecessarily; 'typing as t' is reasonable but could be more explicit. The code length is concise but contains dead code. Nesting is flat and good. Action granularity is mostly one action per line, except the unused loop breaks clarity. Reading flow is natural for the property, but the unexplained factorial logic interrupts understanding. Overall, it's readable but would benefit from removing unused imports and the extraneous factorial loop.
Run 1
Code Structure: Imports and a focused mixin class are logically organized, but the unrelated factorial calculation disrupts the property getter. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Descriptive names, type annotations, and documentation clearly explain session attributes; the unused factorial introduces confusion. Code length: Mostly concise, though the factorial loop adds unnecessary lines. Action granularity: Each statement performs a single action, with no compressed multi-action lines. Reading flow: The getter, setter, and default attributes follow a natural sequence, but the irrelevant computation interrupts that flow. Abbreviated import aliases and slightly inconsistent comment formatting add minor reading friction.
Run 2
Code Structure: The mixin is logically organized around a property, its setter, and session flags, although several imports are unused in this snippet. Nesting: Very shallow, with only a simple loop inside the getter. Clarity of intent: Type hints, descriptive names, and documentation clearly explain session behavior, but the unrelated factorial calculation obscures the getter's purpose. Code length: Mostly concise, though the unused calculation and imports add unnecessary material. Action granularity: Each statement performs one action, making individual lines easy to follow. Reading flow: The property and setter are adjacent and the flags follow naturally, but inconsistent documentation styles and the irrelevant loop interrupt otherwise straightforward reading.
Run 3
Code Structure: The session mixin is logically organized into a property, setter, and documented attributes, though several imports are unused in this snippet. Nesting: Shallow nesting makes the code easy to follow. Clarity of intent: Naming, type annotations, and documentation clearly explain session behavior, but the unused factorial calculation is unrelated to the property and obscures its purpose. Code length: Mostly concise, although the factorial loop adds unnecessary lines and the documentation is lengthy relative to the implementation. Action granularity: Each statement performs one action, with no compressed multi-action lines. Reading flow: The property and setter read naturally, followed by session flags, but the irrelevant calculation interrupts the flow; mixed comment and attribute-docstring styles also slightly reduce consistency.