Sample
pyint-1f55e91cf158-I12
Inline all eligible single-use intermediate local variables
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.33 | 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 generally readable with a clear single-purpose class. Imports are split across logical groups (future, typing, standard library, third-party, local). The class is flat with minimal nesting and each method has a clear, narrow responsibility. Naming is consistent and descriptive. Type hints and docstrings/comment improve clarity. Action granularity is appropriate, with one main operation per line in the comprehension. However, a few minor issues prevent a higher score: the `check` and `to_json` methods lack explicit return type annotations, the redundant `tag = to_json` alias is slightly confusing without context, and the local import grouping is slightly inconsistent.
Run 3
The code has clear intent and reasonable structure but omits needed imports and context. The PassDict class is logically organized with a check method for type validation and a to_json method for serialization, while aliasing tag to to_json adds clarity. Nesting is minimal and action granularity is acceptable, with one primary operation per method. However, readability suffers due to missing imports for JSONTag and t (typing), making the code incomplete and harder to evaluate in isolation. The class uses __slots__ efficiently, but the unexplained import of multiple utilities (b64decode, b64encode, datetime, UUID, Markup, http_date, parse_date, dumps, loads) is unnecessary for the shown logic and adds clutter. The comment about JSON object keys is helpful, but the alias tag = to_json could be clearer with a docstring. Overall, the code is reasonably readable but could be improved with cleaner imports and better context.
Run 1
Code Structure: The class is logically organized into type checking and serialization methods, although the snippet includes unused imports and does not show the JSONTag definition. Nesting: Minimal nesting; the dictionary comprehension is easy to follow. Clarity of intent: Method names, type annotations, and the comment clearly explain dictionary handling, though the tag alias assumes familiarity with the surrounding framework. Code length: The implementation is concise, but the unused imports add clutter. Action granularity: Each statement performs a focused action; the comprehension compactly expresses a single transformation. Reading flow: The progression from checking values to serializing them is natural, with minor readability costs from sparse spacing and missing surrounding context.
Run 2
Code Structure: A small, logically organized class separates type checking from value conversion, although several imports appear unused and JSONTag is not defined in the snippet. Nesting: Minimal nesting; the dictionary comprehension is easy to follow. Clarity of intent: Method names and the comment clearly explain dictionary handling and tagging values rather than keys, though the tag alias and serializer dependency require surrounding context. Code length: The implementation is concise without unnecessary method complexity, but the import block adds clutter. Action granularity: Each statement performs one clear action; the comprehension naturally combines iteration and transformation. Reading flow: Imports, class definition, check method, conversion method, and alias follow a natural progression, though additional spacing between imports and the class would improve visual separation.
Run 3
Code Structure: The class is logically organized into a type check and serialization method, although JSONTag is not defined or imported in the snippet and several imports are unused. Nesting: Minimal nesting and a straightforward dictionary comprehension make the code easy to follow. Clarity of intent: Method names and the comment clearly communicate dictionary handling, though the tag alias and serializer dependency require external context. Code length: The class is concise, but the unused imports add clutter. Action granularity: Each statement performs one clear action; the comprehension compactly expresses a single transformation. Reading flow: Imports followed by the class and its methods create a natural progression, though additional spacing between import groups and the class would improve presentation.