Sample
pyint-24bc0dca37b2-I06
Invert eligible conditions and exchange their branches
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 | 17 | 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 highly readable. It has clear imports, a single class with two small methods, and flat logic. The purpose is explicit: detect dictionaries and serialize them with tagged values. The comment clarifies a design decision about key handling. Variable names are concise and appropriate. Each method performs one logical action per line. The overall flow is natural and easy to follow.
Run 2
The code is well-structured and readable. It uses clear imports, a single class with a focused purpose, and flat logic with no deep nesting. Each method has a clear intent, and the `tag = to_json` alias is concise. The only minor deductions are for the slightly cryptic `__slots__ = ()` without explanation and the ambiguous relationship between `tag` and `to_json`, which could benefit from a comment. Overall, a very clean implementation.
Run 3
The code is structured logically, with a single class containing two short, focused methods. Imports are organized, and type hints improve clarity. However, some elements reduce readability: the `tag = to_json` alias is ambiguous without context and introduces potential confusion. The `check` and `to_json` methods are concise, but the lack of docstrings or comments explaining the purpose of `PassDict` within the larger serialization system makes intent less clear. Nesting is minimal and reading flow is natural. Action granularity is appropriate—one logical operation per line in the comprehension. Overall, the code is clean and maintainable, but clarity could be improved with documentation or a more descriptive alias.
Run 1
Code Structure: The class is logically organized into type checking and JSON conversion, though JSONTag is not defined or imported in the snippet. Nesting: Minimal nesting and a simple dictionary comprehension keep the code easy to follow. Clarity of intent: Descriptive method names and a useful comment explain the conversion, although the tag alias and serializer dependency require surrounding context. Code length: The implementation is concise, but numerous unused imports clutter this standalone snippet. Action granularity: Each statement performs a single clear action; the comprehension expresses one cohesive transformation. Reading flow: Methods follow a natural sequence, with consistent formatting, though additional spacing around the class declaration would improve readability.
Run 2
Code Structure: Imports and a small class are logically organized, though several imports are unused in this snippet and JSONTag is not defined or imported. Nesting: Methods are flat, with only a straightforward dictionary comprehension. Clarity of intent: check clearly identifies dictionaries, and to_json recursively tags values; the comment explains why keys are left unchanged. The tag alias and serializer dependency require surrounding context. Code length: The implementation is concise, but unused imports add clutter. Action granularity: Each statement performs one clear action, and the comprehension expresses a single transformation. Reading flow: The progression from type checking to conversion to aliasing is natural; additional spacing between imports and the class would improve presentation.
Run 3
Code Structure: The class is logically organized into checking and conversion methods, although several unused imports and the undefined-in-snippet JSONTag base add clutter and context dependence. Nesting: Minimal nesting; the dictionary comprehension is straightforward. Clarity of intent: Method names, annotations, and the comment clearly convey dictionary handling and value tagging, though the tag alias and inherited serializer require familiarity with the surrounding framework. Code length: The class is concise, but the import block is disproportionate to the shown functionality. Action granularity: Statements generally perform one action per line; the comprehension remains readable. Reading flow: Imports followed by a small class provide a natural progression, with minor friction from limited spacing and missing surrounding definitions.