Sample

pyint-d1ec3ea64986-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines24

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7740–1; higher is more readable
Mi0.4110–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro60–20; mean of three runs
GPT-6.1 Sol12.670–20; mean of three runs
BTTF0.3980–1; higher is more readable

Views

Source code

from __future__ import annotations import typing as t from base64 import b64decode from base64 import b64encode from datetime import datetime from uuid import UUID from markupsafe import Markup from werkzeug.http import http_date from werkzeug.http import parse_date from ..json import dumps from ..json import loads class PassDict(JSONTag): __slots__ = () def che(self, val: t.Any) -> bool: return isinstance(val, dict) def to(self, val2: t.Any) -> t.Any: # JSON objects may only have string keys, so don't bother tagging the # key here. return {k2: self.serializer.tag(v2) for k2, v2 in val2.items()} tag = to_json

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(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.719.361−23.739
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.746−7.119

Intercept 8.87 + feature contributions = -12.388 (log-odds).
Score = sigmoid(-12.388) = 0.

Feature contributions

FeatureValueContribution
(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.065+0.31
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.756−0.078
Indentation frequencyHow rapidly indentation changes from line to line.22+0.024

Intercept 0.07 + feature contributions = 1.23 (log-odds).
Score = sigmoid(1.23) = 0.774.

Score0.411
Score18
Run 1

The code has multiple readability issues. The class name 'PassDict' is ambiguous and doesn't convey its purpose. Method names 'che' and 'to' are unclear abbreviations that fail to communicate intent. The parameter names 'val' and 'val2', 'k2' and 'v2' are confusing and inconsistent. The code includes unnecessary imports that aren't used in the snippet. The type hint 't.Any' is used inconsistently without proper generic type parameters. The class inherits from 'JSONTag' but this relationship isn't explained. The 'tag = to_json' assignment lacks context and creates confusion about the method's role. While the code length is concise and nesting is minimal, the lack of clear naming, documentation, and consistent typing significantly hampers readability. The single dict comprehension is readable, but surrounding elements make the overall code difficult to understand without additional context.

Run 2

The code suffers from multiple readability issues. Naming is unclear and inconsistent: 'che' and 'to' are not descriptive, 'val2', 'k2', 'v2' suggest copy-paste artifacts, and 'tag = to_json' creates confusion since 'to_json' is not defined in the shown snippet and contradicts the method name 'to'. The class 'PassDict' inherits from 'JSONTag' but the relationship is unclear without context. Import statements are reasonable but include unused imports (b64decode, b64encode, datetime, UUID, Markup, http_date, parse_date, dumps, loads) which add noise. Structure is acceptable but intent is ambiguous—what does 'PassDict' actually do? Action granularity is okay in the single method but overall code length includes dead imports, inflating complexity. Reading flow is disrupted by missing docstrings and cryptic method names.

Run 3

The code is highly unreadable due to multiple issues across all criteria. Structure is tangled: the class inherits from JSONTag but implements methods with nonsensical names ('che', 'to', 'val2', 'k2', 'v2') that obscure purpose. Clarity of intent is near zero - 'che' likely means 'check' and 'to' likely means 'to_json', but this is not apparent. Nesting is acceptable but action granularity is poor: the dictionary comprehension packs multiple operations into one line. Code length is unreasonably short, sacrificing all readability. Reading flow is disorganized as related imports are unnecessary (b64decode, b64encode, datetime, UUID, Markup, http_date, parse_date all appear unused). The method 'tag = to_json' at class level is confusing and breaks normal class structure. Overall this code appears deliberately obfuscated or the result of aggressive minification.

Run 1

Code Structure: A small class with separate type-checking and conversion methods provides logical organization, but numerous unused imports add clutter. Nesting: Very shallow; the dictionary comprehension is easy to follow. Clarity of intent: The comment explains why keys remain untagged, and serializer.tag suggests value serialization, but abbreviated names such as che, to, val2, and k2 obscure intent. JSONTag and to_json are not defined or imported in the snippet, making the class context and final alias unclear. Code length: Methods are concise, although the import block is disproportionate to the functionality shown. Action granularity: Statements generally perform one action each; the comprehension combines iteration and conversion idiomatically. Reading flow: The class reads naturally from checking to conversion, but sparse spacing around imports and the unexplained tag = to_json assignment interrupt comprehension.

Run 2

Code Structure: Imports and a small class are logically arranged, but many imports appear unused, and JSONTag and to_json are not defined or imported in the snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The comment and dictionary comprehension clearly suggest tagging dictionary values, but abbreviated names such as che, to, val2, k2, and v2 obscure meaning. The relationship between the to method and tag = to_json is unclear. Code length: The implementation is concise, although the import list adds distracting bulk. Action granularity: Each statement generally performs one clear action; the comprehension is compact and readable. Reading flow: The sequence from type checking to conversion is natural, but unexplained dependencies and the final alias interrupt understanding.

Run 3

Code Structure: The class is logically organized into small methods, but numerous unused imports add clutter, and JSONTag and to_json are not defined or imported in the snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The dictionary check and value-tagging comprehension are understandable, and the comment explains why keys are untouched; however, names such as che, to, val2, k2, and v2 are vague, and tag = to_json has an unclear relationship to the methods shown. Code length: The implementation is concise, although the imports outweigh the functional code. Action granularity: Statements generally perform one action per line, and the comprehension remains manageable. Reading flow: The progression from type checking to transformation is natural, but the unexplained final alias and missing surrounding definitions interrupt comprehension.