Sample

pyint-cd7bb8c7531e-I11

Split eligible integer literals into pairs of short-named intermediate variables

Matched original source

Lines17

Scores

MethodScoreScale
Posnett0.9880–1; higher is more readable
Dorn0.8370–1; higher is more readable
Mi0.8190–1; higher is more readable
LLOC7Logical lines; fewer is more readable
DeepSeek V4 Pro16.670–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.7620–1; higher is more readable

Views

Source code

from __future__ import annotations class FrozenError(AttributeError): """ A frozen/immutable instance or attribute have been attempted to be modified. It mirrors the behavior of ``namedtuples`` by using the same error message and subclassing `AttributeError`. .. versionadded:: 20.1.0 """ def __init__(self): msg = "can't set attribute" super().__init__(msg) self.msg = msg

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Source linesThe number of non-empty source lines.17+6.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.447−6.671
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.140.182−4.626

Intercept 8.87 + feature contributions = 4.373 (log-odds).
Score = sigmoid(4.373) = 0.988.

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.033+0.622
Indentation frequencyHow rapidly indentation changes from line to line.9−0.426
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.18+0.399
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.73.556+0.382
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.78+0.361
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.16.873−0.174

Intercept 0.07 + feature contributions = 1.633 (log-odds).
Score = sigmoid(1.633) = 0.837.

Score0.819
Score7
Run 1

The code is highly readable. Structure is logical and well-organized: a custom exception class with a clear docstring, proper inheritance from AttributeError, and a straightforward __init__ method. Nesting is minimal and flat. Intent is unambiguous—creating a frozen attribute error mirroring namedtuple behavior. Length is concise with no unnecessary code. Each action (creating message, calling super, assigning attribute) is on its own line, following clean action granularity. Reading flow is natural, from class definition to docstring to initialization. Minor deductions: the 'msg' attribute assignment is slightly redundant since the message is already stored by the base exception, and the docstring could be trimmed, but these are trivial and don't hinder comprehension.

Run 2

The code is well-structured and readable. It defines a custom exception with a clear purpose, using a docstring that explains intent and mirrors a familiar pattern from namedtuples. Nesting is minimal—just one level in the constructor. Naming is explicit and the method does a single logical action. The only minor downsides are slight redundancy in setting both the message and an instance attribute ('self.msg'), which may be unnecessary, and the class name 'FrozenError' could be slightly more descriptive (e.g., FrozenInstanceError). The code is concise, with clear flow and no ambiguity. Overall, highly readable with minor room for simplification.

Run 3

The code is highly readable. It has a clear, single-purpose class with well-structured logic and a flat hierarchy. The intent is explicitly documented through a precise docstring, and the error message mirrors a familiar pattern (namedtuples). The class length is concise, and actions are cleanly separated. The reading flow is natural, with no unnecessary complexity or nesting. Minor deductions for slightly redundant self.msg, but overall excellent clarity.

Run 1

Code Structure: A logically organized exception class with a descriptive docstring and straightforward initializer. Nesting: Minimal, limited to the class and method scopes. Clarity of intent: The class name, inheritance, and documentation clearly communicate its purpose, although the docstring's opening sentence is grammatically awkward. Code length: Short and focused; retaining the message in self.msg adds a small amount of potentially redundant code. Action granularity: Each statement performs one clear action. Reading flow: Natural progression from import to class documentation to initialization, with consistent indentation and spacing.

Run 2

Code Structure: The exception class, explanatory docstring, and initializer are logically organized. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name, AttributeError inheritance, and docstring clearly communicate its purpose, although the docstring's first sentence is grammatically awkward. Code length: Short and focused; the documentation is proportionate to this public exception class. Action granularity: Each statement performs a single action. Reading flow: Natural progression from import to class documentation to initialization, with the message defined before use. Minor wording and spacing improvements would make the presentation more polished.

Run 3

Code Structure: A single, logically organized exception class with documentation followed by initialization. Nesting: Minimal, limited to the class and its constructor. Clarity of intent: The class name, AttributeError inheritance, docstring, and error message clearly communicate its purpose, although the docstring's opening sentence is grammatically awkward. Code length: Concise overall; the version note and explanatory documentation add useful context. Action granularity: Each statement performs one action on its own line. Reading flow: Natural progression from import to class documentation to constructor, with appropriate spacing. The extra self.msg assignment slightly increases the code's footprint but remains easy to understand.