Sample

pyint-8b55ce558f5c-SRC

Unmodified source class

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 Pro17.330–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. It has a clear, single-purpose class with a logical structure, flat nesting, and a concise docstring explaining intent and behavior. The `FrozenError` class cleanly subclasses `AttributeError`, and the constructor is minimal, constructing a message and delegating to the parent initializer. The action granularity is appropriate—one distinct action per line—and the reading flow is natural from docstring to implementation. Minor deductions: the `msg` attribute is redundant since the message is already stored in `args` via `super().__init__(msg)`, and the code could be shorter by inlining the message, but these do not significantly impair readability.

Run 2

The code is highly readable. It follows a clear, logical structure: module import, class with docstring, and a succinct __init__ method. Nesting is minimal, with only one method and no deep indentation. Intent is explicit through descriptive naming and comprehensive documentation, including version and behavior notes. Code length is concise and appropriate for defining a custom exception, with no unnecessary logic. Action granularity is appropriate: each line handles a distinct task (assign message, call super, store attribute). The reading flow is natural, from the explanation to the implementation details.

Run 3

The code is well-structured and highly readable. It defines a custom exception class with a clear purpose, good documentation, and proper inheritance. The nesting is flat, with only one class definition and one method, making it easy to follow. The clarity of intent is excellent—the docstring explains the behavior, version, and design rationale. The code length is concise, avoiding unnecessary verbosity while including essential context. Action granularity is appropriate: each line performs a single logical operation (creating the message, calling parent constructor, assigning attribute). The reading flow is natural—docstring, class declaration, method, then simple sequential statements. The only minor deductions are for the slightly redundant self.msg assignment (since the message is already stored by the parent class) and the lack of type hints on the method, though these are negligible given the context. Overall, this is clean, idiomatic Python code.

Run 1

Code Structure: The exception class, documentation, and initializer are logically organized. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The descriptive class name, AttributeError inheritance, and docstring clearly communicate the purpose, though the docstring's opening sentence is grammatically awkward. Code length: The implementation is concise; storing the message in self.msg adds a small amount of potentially unnecessary code. Action granularity: Each statement performs one action. Reading flow: The progression from class declaration to explanation to initialization is natural and straightforward.

Run 2

Code Structure: The exception class is logically organized, with documentation followed by a straightforward initializer. 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 opening sentence is grammatically awkward. Code length: Concise overall; the version note and compatibility explanation add useful context without excessive length. Action granularity: Each statement performs a single action. Reading flow: Execution proceeds naturally from defining the message to initializing the parent exception and storing the message on the instance.

Run 3

Code Structure: The import, exception class, docstring, and initializer are logically organized. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The descriptive class name, documentation, and explicit error message clearly communicate its purpose, though the docstring's opening sentence is grammatically awkward. Code length: The implementation is concise; storing the message in both the exception and self.msg introduces slight redundancy. Action granularity: Each statement performs one clear action. Reading flow: The code proceeds naturally from documentation to message creation, superclass initialization, and attribute assignment.