Sample
pyint-27582e43d915-SRC
Unmodified source class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.775 | 0–1; higher is more readable |
| Mi | 0.377 | 0–1; higher is more readable |
| LLOC | 18 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 0–20; mean of three runs |
| BTTF | 0.449 | 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. | 712.555 | −23.514 |
| Source linesThe number of non-empty source lines. | 24 | +9.6 |
| 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.726 | −7.088 |
Intercept 8.87 + feature contributions = -12.133 (log-odds).
Score = sigmoid(-12.133) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 76.48 | +0.43 |
| 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. | 76.92 | +0.407 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.064 | +0.319 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 25 | +0.151 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 22 | −0.084 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 23.795 | −0.077 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 22 | +0.024 |
Intercept 0.07 + feature contributions = 1.239 (log-odds).
Score = sigmoid(1.239) = 0.775.
| Score | 0.377 |
|---|
| Score | 18 |
|---|
Run 1
The code is well-organized with a logical structure: clear imports, class definition, and method separation. It maintains a flat structure with no nested blocks beyond the single comprehension in `to_json`, which remains readable. Intent is explicit—this class implements a JSON tag for dictionaries—although the relationship to `JSONTag` isn't fully visible from this snippet alone. Code length is concise, avoiding unnecessary verbosity. Action granularity is appropriate: one logical action per line in `check`, and the comprehension in `to_json` is compact yet clear. Reading flow is natural from top to bottom. Minor deductions: missing type hints on return values for methods (e.g., `-> bool`, `-> t.Any`), and the alias `tag = to_json` could surprise readers unfamiliar with the parent class's expectations. Overall, highly readable with only small improvements possible.
Run 2
The code is highly readable due to its clear structure, minimal nesting, and concise implementation. It defines a single class with a clear purpose: tagging JSON dictionaries for serialization. Each method is short and focused, with one action per line, making the logic easy to follow. The type hints, future annotations import, and explicit use of `t.Any` improve clarity. The comment in `to_json` succinctly explains a potential ambiguity, enhancing intent. The code avoids unnecessary complexity, maintains a natural reading flow, and uses appropriate abstractions. Minor deductions could be made for the redundant `tag = to_json` assignment, which may be intentional for interface consistency but isn't immediately obvious.
Run 3
The code is generally readable with a clear logical structure. It begins with cleanly organized imports, which aids navigation. The class definition is concise and the purpose—tagging a dict for JSON serialization—is reasonably clear, especially with the clarifying comment about string keys. However, the intent of the class and its relationship to the undefined `JSONTag` base class is not fully self-evident from the snippet alone, slightly impacting clarity. The `tag = to_json` alias near the end is somewhat ambiguous without external context; a brief comment explaining why the alias exists would improve intent. Nesting is minimal and line-level action granularity is appropriate. The code length is concise but not overly terse. Overall, the structure is sound, but the lack of a docstring and the unexplained alias prevent it from scoring higher in readability.
Run 1
Code Structure: The class is logically organized into a type check, conversion method, and alias, although JSONTag is not defined or imported in the snippet and several imports appear unused. Nesting: Minimal nesting; the dictionary comprehension is straightforward. Clarity of intent: Method names, type annotations, and the comment clearly convey dictionary serialization, though the tag alias requires some contextual knowledge. Code length: The implementation is concise, with imports accounting for most unnecessary length in isolation. Action granularity: Each statement performs a focused action; the comprehension combines iteration and conversion idiomatically. Reading flow: The progression from checking the value to converting it is natural, with minor spacing improvements possible around imports and the class.
Run 2
Code Structure: The class is logically organized into type checking, serialization, and an alias, although numerous unused imports and the undefined-in-snippet JSONTag base class add clutter. Nesting: Minimal nesting and a simple dictionary comprehension keep the code easy to follow. Clarity of intent: Descriptive method names and the comment explain dictionary handling, though PassDict and tag = to_json require some framework context. Code length: The class is concise, but the import block is disproportionately long for this snippet. Action granularity: Each statement performs a clear action; the comprehension compactly expresses a straightforward transformation. Reading flow: Imports followed by the class and its methods provide a natural progression, although additional spacing before the class would improve visual separation.
Run 3
Code Structure: The class is logically organized into type checking, serialization, and a method alias, though many unused imports clutter the snippet and JSONTag is not defined or imported here. Nesting: Methods are flat, with only a straightforward dictionary comprehension. Clarity of intent: Method names, type annotations, and the comment clearly communicate dictionary serialization, although the tag alias and serializer dependency require surrounding context. Code length: The implementation is concise, but the import section is disproportionately long for the functionality shown. Action granularity: Each statement performs one clear action; the comprehension naturally combines iteration and transformation. Reading flow: The methods follow a natural progression, but minimal spacing around the imports and class slightly reduces visual separation.