Sample

pyint-dad8049c64d1-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines27

Scores

MethodScoreScale
Posnett0.0060–1; higher is more readable
Dorn0.8460–1; higher is more readable
Mi0.4010–1; higher is more readable
LLOC13Logical lines; fewer is more readable
DeepSeek V4 Pro140–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.7050–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, *step: Any, **amount: 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, *step) InvalidJSONError.__init__(self, *self.args, **amount) 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.675−7.012

Intercept 8.87 + feature contributions = -5.07 (log-odds).
Score = sigmoid(-5.07) = 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.039+0.559
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.849−0.035

Intercept 0.07 + feature contributions = 1.7 (log-odds).
Score = sigmoid(1.7) = 0.846.

Score0.401
Score13
Run 1

The code is well-structured with clear class organization and logical inheritance. Nesting is minimal — only one method body is indented, and there are no deeply nested blocks. Intent is clearly documented with docstrings explaining the rationale for multiple inheritance and method overriding. Length is concise: each method performs a focused task without redundant code. Action granularity is good, with single clear operations per line (e.g., delegating initialization calls and returning the result of __reduce__). Reading flow is natural, starting from imports, moving to class definition, then methods in a logical order. The only minor readability drawback is the unusual parameter names (step and amount instead of doc or msg), which slightly obscures intent, and the multiple inheritance order requires the docstring for clarity. Overall, the code is highly readable and maintainable.

Run 2

The code has clear purpose and good docstrings explaining non-obvious design choices like MRO and pickling. The class structure is straightforward, with low nesting and one action per method. However, readability suffers from poor parameter naming (`*step`, `**amount`) that obscures their roles, and the inheritance pattern with multiple exception base classes adds complexity. The docstrings are helpful but could be more concise. Overall the code is logical but naming choices reduce clarity.

Run 3

The code has a clear structure and purpose, with docstrings explaining non-obvious behavior. However, readability suffers due to ambiguous variable names like `*step` and `**amount` that obscure the actual parameters (doc, pos). The double inheritance and manual __init__ calls create subtle complexity that isn't immediately obvious without careful reading. Nesting is minimal and action granularity is good. The __reduce__ method is clear in intent but the implementation relies on understanding MRO intricacies. Overall, the code is maintainable but could benefit from more descriptive parameter names and clearer comments about the inheritance order implications.

Run 1

Code Structure: The class is logically organized into initialization and pickling methods, although InvalidJSONError is not defined or imported in the snippet and some imports are unused. Nesting: Methods are flat, with no nested control flow. Clarity of intent: Descriptive docstrings explain the multiple-inheritance behavior, but unconventional parameter names step and amount obscure their roles as positional and keyword arguments. Code length: The implementation is concise; the lengthy docstrings largely justify themselves by explaining subtle behavior. Action granularity: Each statement performs one clear action. Reading flow: Initialization followed by serialization support is natural, though missing context for InvalidJSONError and minor grammatical issues in the documentation interrupt readability.

Run 2

Code Structure: Imports and a focused exception class are logically organized, though InvalidJSONError is undefined in the snippet and some imports are unused. Nesting: Flat methods with no nested control flow make scanning easy. Clarity of intent: The class name and docstrings explain initialization and pickling behavior well, but the parameter names 'step' and 'amount' obscure their conventional roles as args and kwargs. Code length: Implementation is concise; docstrings are useful but somewhat verbose. Action granularity: Each statement performs one clear action. Reading flow: Initialization followed by serialization support is natural, although multiple inheritance and explicit parent-method calls require familiarity with exception behavior.

Run 3

Code Structure: The class cleanly groups initialization and pickling behavior, although InvalidJSONError is not defined or imported in the snippet, and several imports are unused. Nesting: Methods are flat, with no nested control flow. Clarity of intent: Descriptive class and method docstrings explain the multiple-inheritance behavior, but the parameter names step and amount obscure their roles as positional and keyword arguments. Code length: The implementation is concise; the explanatory docstrings are useful but somewhat verbose. Action granularity: Each executable line performs one clear operation. Reading flow: Imports, class declaration, initialization, and serialization follow a natural sequence, though the missing dependency and unconventional parameter names interrupt comprehension.