Sample

pyint-b5fc1bbe0d0b-SRC

Unmodified source class

Lines29

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8590–1; higher is more readable
Mi0.3340–1; higher is more readable
LLOC16Logical lines; fewer is more readable
DeepSeek V4 Pro170–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.6120–1; higher is more readable

Views

Source code

import operator import re from contextlib import contextmanager from re import Pattern from ._config import get_run_validators, set_run_validators from ._make import _AndValidator, and_, attrib, attrs from .converters import default_if_none from .exceptions import NotCallableError @attrs(repr=False, slots=False, unsafe_hash=True) class _IsCallableValidator: def __call__(self, inst, attr, value): """ We use a callable class to be able to change the ``__repr__``. """ if not callable(value): message = ( "'{name}' must be callable " "(got {value!r} that is a {actual!r})." ) raise NotCallableError( msg=message.format( name=attr.name, value=value, actual=value.__class__ ), value=value, ) def __repr__(self): return "<is_callable validator>"

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.711.107−23.467
Source linesThe number of non-empty source lines.29+11.6
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.279−6.419

Intercept 8.87 + feature contributions = -9.415 (log-odds).
Score = sigmoid(-9.415) = 0.

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.70.967+0.659
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.052+0.432
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.27+0.197
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.54.967+0.082
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.30−0.026
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.28.889−0.006

Intercept 0.07 + feature contributions = 1.807 (log-odds).
Score = sigmoid(1.807) = 0.859.

Score0.334
Score16
Run 1

The code is concise, logically organized, and highly readable. It imports only necessary components and defines a single-purpose callable validator class. The structure is flat with minimal nesting — only one conditional inside `__call__`, which reads clearly. Clarity of intent is strong: the purpose of validating that a value is callable is evident from class and method names, and the docstring explains the design choice. Action granularity is appropriate, with mostly one logical action per line (e.g., message construction, raising the error, returning the repr). The reading flow is natural: imports, class definition, validation logic, then repr override. The only minor weakness is the multi-line string formatting within `raise`, but it remains readable. Overall, this is well-structured, idiomatic Python that would be easy for another developer to understand and maintain.

Run 2

The code is well-structured and readable. It consists of a single focused class with one method and a __repr__ method, clearly separated by action. Nesting is minimal, with only a single conditional inside the __call__ method. The intent is unambiguous: validate that a value is callable and provide a clear error message otherwise. The error message construction is broken into logical lines, improving readability despite slightly longer code. Action granularity is appropriate, with each logical step on its own line. Reading flow is natural: imports, class definition, validator method with clear error handling, then repr. Minor deductions for slight verbosity in the error message formatting, but overall clarity is high.

Run 3

The code is generally well-structured and readable. It uses clear imports, a single class with a focused responsibility, and a logical method flow. The __call__ method is flat, with only one level of nesting for the if statement, which is good. Intent is clear: validating callable attributes. The error message construction is slightly verbose but improves clarity. Minor drawbacks include the multi-line string inside the method, which adds length without much benefit, and the unused imports (operator, re, Pattern, contextmanager, get_run_validators, set_run_validators, etc.) which could confuse readers. Overall, the code is concise, actions are separated reasonably, and the reading flow is natural.

Run 1

Code Structure: Imports and a single validator class are logically organized, although several imports appear unused in this snippet. Nesting: The implementation is shallow, with only one conditional and straightforward error construction. Clarity of intent: Descriptive class and exception names, the callable check, and a helpful docstring make the purpose clear; abbreviated parameters and decorator options require some framework familiarity. Code length: The validator is concise without unnecessary logic, though unused imports add clutter. Action granularity: Each statement performs a distinct action, and the multiline message formatting remains readable. Reading flow: Execution naturally progresses from validation to error reporting, followed by the representation method. Slightly more spacing between imports and the class would improve presentation.

Run 2

Code Structure: The validator is logically organized into validation and representation methods, though numerous unused imports distract from its small scope. Nesting: A single conditional keeps nesting shallow; the nested formatting call remains easy to follow. Clarity of intent: Descriptive class naming, the callable check, and a detailed exception clearly communicate the purpose. The docstring explains the class-based design rather than the method's behavior, and abbreviated parameters slightly reduce clarity. Code length: The implementation is concise, with reasonable multiline formatting for the error message. Action granularity: Each statement performs one clear action, with no compressed or semicolon-separated operations. Reading flow: Execution proceeds naturally from checking the value to constructing and raising an informative exception, followed by a simple representation method.

Run 3

Code Structure: Imports and a focused validator class are logically organized, although several imports appear unused in this snippet. Nesting: A single conditional keeps control flow shallow; nested formatting adds only minor visual complexity. Clarity of intent: Descriptive class and method names, a brief explanatory docstring, and a detailed error message make the purpose clear. Code length: The implementation is concise, with reasonable multiline formatting for the exception. Action granularity: Each statement performs one clear action, and arguments are separated for readability. Reading flow: The code moves naturally from validation to error reporting and then representation; framework-specific decorators and exception conventions require some background knowledge.