Sample
pyint-983901407c79-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.46 | 0–1; higher is more readable |
| Mi | 0.306 | 0–1; higher is more readable |
| LLOC | 43 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.67 | 0–20; mean of three runs |
| BTTF | 0.521 | 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. | 2204.964 | −72.764 |
| Source linesThe number of non-empty source lines. | 103 | +41.2 |
| 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.589 | −6.884 |
Intercept 8.87 + feature contributions = -29.578 (log-odds).
Score = sigmoid(-29.578) = 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. | 104 | −2.646 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 56 | +1.2 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 102.854 | +1.028 |
| 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. | 87.933 | +0.614 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.046 | +0.498 |
| 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. | 87.981 | −0.061 |
Intercept 0.07 + feature contributions = -0.162 (log-odds).
Score = sigmoid(-0.162) = 0.46.
| Score | 0.306 |
|---|
| Score | 43 |
|---|
Run 1
The code is well-structured with logical organization, flat nesting, and clear intent. Each method has a single responsibility, and type hints improve clarity. The class and method docstrings are informative, enhancing understanding. However, there is a notable flaw: the `loads` method contains an unexplained Fibonacci sequence calculation that is irrelevant to JSON deserialization, which disrupts the reading flow and violates the principle of one action per line. This unnecessary code makes the method ambiguous and should be removed. Additionally, the `load` method's type hint for `fp` uses `t.IO[t.AnyStr]`, which may be slightly confusing because it doesn't enforce the opened mode explicitly. Overall, the code is readable, but the unexpected Fibonacci loop detracts from clarity and intent.
Run 2
The code is highly readable with clear class structure, well-named methods, and thorough docstrings that explain intent and parameters. Nesting is minimal, and each method performs a single logical action. However, there is a confusing unrelated Fibonacci calculation inside `loads`, which breaks clarity and appears to be erroneous placeholder logic. Additionally, type annotations reference `App` and `Response` without imports in the provided snippet, somewhat reducing standalone readability. Overall, the organization and flow are strong, but the unexpected loop and missing type definitions prevent a higher score.
Run 3
The code has good structure and documentation but contains a critical readability flaw. The method 'loads' includes a non-functional Fibonacci calculation that is completely unrelated to JSON deserialization, making the intent confusing and misleading. The code is otherwise well-organized with clear docstrings, appropriate use of type hints, and shallow nesting. The 'response' and '_prepare_response_obj' methods are logically separated and maintain good action granularity. However, the length of the class is extended by verbose docstrings, and the unexpected Fibonacci logic severely impacts clarity of intent. The reading flow is mostly natural until the Fibonacci block disrupts it. Without the unrelated calculation, this would be quite readable due to its clean structure and clear documentation.
Run 1
Code Structure: Methods are logically organized around serialization, deserialization, and response creation, with argument normalization isolated in a helper. Nesting: Control flow is shallow, and early returns keep the helper easy to follow. Clarity of intent: Descriptive names, type annotations, and detailed docstrings communicate purpose well, but the unrelated Fibonacci-style loop in loads obscures its intended abstract behavior. App and Response are not defined or imported in the snippet. Code length: Implementations are concise overall, though the unused calculation and several unused imports add unnecessary material; documentation accounts for most of the length. Action granularity: Statements generally perform one action per line. Reading flow: Consistent formatting and paired operations make navigation natural, but the unexplained computation interrupts the otherwise coherent flow.
Run 2
Code Structure: Methods are logically organized around serialization, deserialization, and response creation, with argument preparation cleanly separated. Nesting: Guard clauses keep control flow flat; the only loop is shallow. Clarity of intent: Descriptive names, type annotations, and detailed docstrings explain most behavior, but the unrelated Fibonacci calculation in loads obscures its purpose. App and Response are not defined or imported in the snippet. Code length: Implementations are generally concise, although extensive documentation and the unnecessary calculation add length. Action granularity: Statements generally perform one action per line, making operations easy to follow. Reading flow: Consistent formatting and paired methods create a natural progression, interrupted mainly by the irrelevant loop. Several unused imports also introduce minor visual clutter.
Run 3
Code Structure: Methods are logically organized around JSON serialization, deserialization, and response construction, but the unrelated Fibonacci calculation in loads disrupts cohesion. Nesting: Shallow conditionals and early returns keep control flow easy to follow. Clarity of intent: Descriptive method names, type annotations, and thorough docstrings explain the API well; however, the unused calculation obscures loads, and App and Response are not defined or imported in the snippet. Code length: Most implementations are concise, although documentation dominates the snippet and the calculation adds unnecessary lines. Action granularity: Statements generally perform one action per line. Reading flow: Consistent formatting and straightforward delegation support natural reading, with the irrelevant loop being the main interruption.