Sample

pyint-51cf84a2d865-I04

Replace names with deterministic minifier-style shortest identifiers

Matched original source

Lines27

Scores

MethodScoreScale
Posnett0.0060–1; higher is more readable
Dorn0.8450–1; higher is more readable
Mi0.4040–1; higher is more readable
LLOC13Logical lines; fewer is more readable
DeepSeek V4 Pro15.330–20; mean of three runs
GPT-6.1 Sol16.670–20; mean of three runs
BTTF0.4690–1; higher is more readable

Views

Source code

from __future__ import annotations from typing import TYPE_CHECKING, Any from urllib3.exceptions import HTTPError as BaseHTTPError from .compat import JSONDecodeError as CompatJSONDecodeError class JSONDecodeError(InvalidJSONError, CompatJSONDecodeError): """Couldn't decode the text into json""" def __init__(self, *a: Any, **b: Any) -> None: """ Construct the JSONDecodeError instance first with all args. Then use it's args to construct the IOError so that the json specific args aren't used as IOError specific args and the error message from JSONDecodeError is preserved. """ CompatJSONDecodeError.__init__(self, *a) InvalidJSONError.__init__(self, *self.args, **b) def __reduce__(self) -> tuple[Any, ...] | str: """ The __reduce__ method called when pickling the object must be the one from the JSONDecodeError (be it json/simplejson) as it expects all the arguments for instantiation, not just one like the IOError, and the MRO would by default call the __reduce__ method from the IOError due to the inheritance order. """ return CompatJSONDecodeError.__reduce__(self)

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.537.2−17.728
Source linesThe number of non-empty source lines.27+10.8
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.678−7.016

Intercept 8.87 + feature contributions = -5.074 (log-odds).
Score = sigmoid(-5.074) = 0.006.

Feature contributions

FeatureValueContribution
(log-odds)
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.71.964+0.617
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.04+0.554
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.61.857+0.194
Indentation frequencyHow rapidly indentation changes from line to line.16−0.184
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.27+0.08
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.26.781−0.035

Intercept 0.07 + feature contributions = 1.694 (log-odds).
Score = sigmoid(1.694) = 0.845.

Score0.404
Score13
Run 1

The code is generally clear and well-structured. It uses a logical inheritance pattern with clear docstrings explaining non-obvious design decisions. The class and method purposes are evident. Nesting is minimal, and action granularity is appropriate. Reading flow is natural, with imports, class definition, and methods in a sensible order. However, the constructor's logic could benefit from an explanatory comment within its body, as the reasoning for calling CompatJSONDecodeError first is only in the docstring. The __reduce__ method's docstring is thorough but somewhat verbose for the amount of code. The code is concise and avoids unnecessary complexity, making it readable. Overall, it's solidly written but lacks minor inline clarity within method bodies.

Run 2

The code is well-structured with clear class hierarchy and inheritance. Nesting is minimal, with only one class and two methods, keeping the code flat and readable. Intent is clearly communicated through docstrings explaining the rationale behind constructor ordering and __reduce__ override. Code length is concise, with no unnecessary duplication. Action granularity is good, with each line performing a discrete operation. Reading flow is natural, with the class definition followed by logical method implementations. Minor deductions: the use of *a and **b reduces clarity slightly, and there is no type hinting on method parameters despite the module-level typing import. The exception handling structure is slightly unusual but adequately documented.

Run 3

The code is generally readable with clear docstrings explaining non-obvious behavior like the MRO and pickling concerns. Class structure is logical with a single class and two methods. Nesting is flat. However, there are some readability deductions: the __init__ signature uses *a and **b which obscures parameter intent despite the docstring; the __reduce__ return type annotation is unusual and slightly unclear; and the dual inheritance with convoluted initialization order requires careful reading. The docstrings add significant length but justify the complexity. Action granularity is acceptable—one main action per line within method calls. Reading flow is decent but the multiple inheritance mechanics dominate the cognitive load. Overall, it's clear for experienced Python developers but somewhat opaque for those unfamiliar with the json/requests library internals.

Run 1

Code Structure: The class logically groups initialization and pickling behavior, though InvalidJSONError is undefined in the snippet and some imports are unused. Nesting: Methods are flat, with no nested control flow. Clarity of intent: The class name and docstrings explain the multiple-inheritance requirements well, but parameter names a and b are less descriptive than args and kwargs. Code length: The implementation is concise; the longer docstrings provide useful context for otherwise subtle behavior. Action granularity: Each executable line performs one clear action. Reading flow: Initialization followed by serialization support is natural, although understanding the base classes and method resolution order requires external context.

Run 2

Code Structure: A single exception class with two focused methods is logically organized, though InvalidJSONError is not defined or imported in the snippet and some imports are unused. Nesting: No nested control flow; both methods are flat. Clarity of intent: The docstrings explain the initialization order and pickling behavior well, but generic parameter names a and b obscure their roles. Code length: The implementation is concise; the explanatory docstrings are somewhat verbose but useful for the inheritance subtleties. Action granularity: Each executable line performs one clear action. Reading flow: Imports, class declaration, initialization, and serialization follow a natural order. Minor spacing issues and grammatical errors in the documentation slightly reduce polish.

Run 3

Code Structure: Imports and a single exception class are logically organized, with initialization and pickling behavior separated into methods. Nesting: The code is flat, without conditional or loop nesting. Clarity of intent: Descriptive class names and docstrings explain the multiple-inheritance behavior, though generic parameter names a and b reduce clarity, and InvalidJSONError is not defined or imported in the snippet. Code length: The implementation is concise; the docstrings are somewhat wordy but explain non-obvious behavior. Action granularity: Each executable line performs one clear action. Reading flow: The sequence from imports to class definition, initialization, and serialization is natural. Unused imports and minor grammatical issues in the documentation add small distractions.