Sample

pyint-ed41d9585699-I10

Deterministically remove some optional blank lines and bracketed line breaks

Matched original source

Lines26

Scores

MethodScoreScale
Posnett0.0050–1; higher is more readable
Dorn0.8430–1; higher is more readable
Mi0.4010–1; higher is more readable
LLOC13Logical lines; fewer is more readable
DeepSeek V4 Pro15.670–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.7250–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, *args: Any, **kwargs: 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, *args) InvalidJSONError.__init__(self, *self.args, **kwargs) 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.533.839−17.617
Source linesThe number of non-empty source lines.26+10.4
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.689−7.033

Intercept 8.87 + feature contributions = -5.38 (log-odds).
Score = sigmoid(-5.38) = 0.005.

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.963+0.617
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.039+0.559
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Indentation frequencyHow rapidly indentation changes from line to line.15−0.218
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.61.556+0.189
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.26+0.116
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.25.849−0.049

Intercept 0.07 + feature contributions = 1.682 (log-odds).
Score = sigmoid(1.682) = 0.843.

Score0.401
Score13
Run 1

The code is generally readable with clear intent and docstrings explaining non-obvious design decisions. The class structure is logical and the methods are short. However, the multiple inheritance and the custom __init__ ordering create conceptual complexity despite explanatory comments. The code uses flat nesting and mostly one action per line, which helps. The reading flow is somewhat disrupted by the dense explanatory docstrings and the need to understand inheritance semantics, but overall it is maintainable and intentional rather than tangled.

Run 2

The code is well-structured with clear separation of class definition, constructor, and serialization method. The inheritance and exception handling logic is explicit, and docstrings provide necessary context for non-obvious design decisions (MRO, pickling). Nesting is minimal, with only one method-level indentation. Intent is clear: define a hybrid JSON decode error class. However, readability is slightly reduced by the unusual multiple inheritance pattern and the need for comments to explain why specific parent methods are called. The __reduce__ method's return type annotation is a bit complex. Overall, the code is concise but context-dependent; someone unfamiliar with the class hierarchy might need to read the docstrings carefully. Action granularity is reasonable, though the constructor chains two initialization calls in sequence, which is acceptable given the explanation.

Run 3

The code is generally readable with clear intent and good structure. The class hierarchy is logical, and docstrings explain non-obvious design choices, such as the __init__ ordering and __reduce__ override. Nesting is minimal, action granularity is reasonable, and the flow is natural. However, the __init__ method's comment and implementation could be clearer, and a few lines are dense. Overall, it's a well-documented and maintainable piece of code.

Run 1

Code Structure: The class logically groups initialization and pickling behavior, though imports lack separation from the class and InvalidJSONError is not defined or imported in the snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Descriptive names and docstrings explain the otherwise subtle multiple-inheritance behavior; unused imports add minor distraction. Code length: Implementation is concise, although the docstrings are somewhat verbose. Action granularity: Each statement performs one clear action. Reading flow: Initialization followed by serialization support is natural, with explicit parent-method calls making execution order clear.

Run 2

Code Structure: The class logically groups initialization and pickling behavior, though missing spacing after imports and the undefined InvalidJSONError base reduce self-contained readability. Nesting: Flat methods with no nested control flow are easy to follow. Clarity of intent: Descriptive aliases, type annotations, and docstrings explain the unusual multiple-inheritance behavior well; unused imports add minor noise. Code length: The implementation is concise, although the docstrings are somewhat verbose and contain minor grammatical issues. Action granularity: Each executable line performs a single clear action. Reading flow: Initialization proceeds naturally, followed by serialization behavior; understanding the inheritance details requires some background knowledge, but the explanations help.

Run 3

Code Structure: Imports and a focused exception class are logically organized, though InvalidJSONError is not defined or imported in the snippet and spacing between imports and the class is missing. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: Descriptive aliases, type annotations, and docstrings explain the unusual initialization and pickling behavior, although multiple inheritance requires background knowledge. Code length: The implementation is concise; the detailed docstrings are useful but slightly wordy. Action granularity: Each statement performs one clear action. Reading flow: Initialization followed by serialization support is natural, but unused TYPE_CHECKING and BaseHTTPError imports add minor distraction.