Sample

pyint-f4ae3cb27f55-I04

Replace names with deterministic minifier-style shortest identifiers

Matched original source

Lines29

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8550–1; higher is more readable
Mi0.5670–1; higher is more readable
LLOC16Logical lines; fewer is more readable
DeepSeek V4 Pro80–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.450–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, a, b, c): """ We use a callable class to be able to change the ``__repr__``. """ if not callable(c): d = ( "'{name}' must be callable " "(got {value!r} that is a {actual!r})." ) raise NotCallableError( msg=d.format( name=b.name, value=c, actual=c.__class__ ), value=c, ) 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.714.305−23.572
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.265−6.397

Intercept 8.87 + feature contributions = -9.499 (log-odds).
Score = sigmoid(-9.499) = 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.69.933+0.703
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.055+0.408
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.51.767+0.031
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.845−0.007

Intercept 0.07 + feature contributions = 1.774 (log-odds).
Score = sigmoid(1.774) = 0.855.

Score0.567
Score16
Run 1

The code has some readability issues. The class definition is dense and uses cryptic variable names (a, b, c) that obscure intent. The __call__ method's parameters are unclear without context, requiring knowledge of attrs validators. The docstring is minimal and doesn't explain the validator's purpose. The error message construction is unnecessarily broken across multiple lines, making it harder to follow. The class lacks type hints. The __repr__ method is straightforward, but the overall structure feels convoluted. The code would benefit from descriptive parameter names, a clearer docstring, and simpler error message formatting. While the logic is relatively simple, the poor naming and formatting choices significantly reduce readability.

Run 2

The code is difficult to read due to poor naming conventions. Parameters like 'a', 'b', 'c', and variable 'd' obscure the purpose of the validator's call method. The logic is relatively short but the opaque identifiers severely hurt clarity of intent and reading flow. While the structure itself is flat and actions are mostly separated, the ambiguous naming makes the code feel tangled. The docstring helps explain 'why' a callable class is used, but does not compensate for unclear argument names in the call signature.

Run 3

The code has a clear purpose and is relatively flat with one main conditional branch, giving it moderate readability. However, several naming choices obscure intent: parameters `a`, `b`, `c`, local `d`, and the fragile `d.format(...)` pattern reduce clarity. The decorator `@attrs(repr=False, slots=False, unsafe_hash=True)` signals purpose but may be unclear without context. The docstring explains the class but not parameters. The few lines keep logical flow and one action per line mostly, but the error construction is split oddly and the `format` call is nested within the raise. Overall readable enough for a small validator, but poor names and minor structural awkwardness hold it back.

Run 1

Code Structure: The validator class is logically organized, with validation and representation separated, though numerous unused imports add clutter. Nesting: Shallow nesting makes control flow easy to follow. Clarity of intent: The class name, callable check, and descriptive error reveal the purpose, but parameter names a, b, c and variable d obscure their roles. The docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is compact, although imports and fragmented message formatting add unnecessary visual length. Action granularity: Statements generally perform one action each, and the multiline exception construction remains understandable. Reading flow: Validation proceeds naturally from checking callability to raising an informative exception, followed by representation; clearer variable names and cleaner imports would improve readability.

Run 2

Code Structure: The validator is logically organized into validation and representation methods, though numerous unused imports add clutter. Nesting: Shallow nesting makes control flow easy to follow. Clarity of intent: The class name, callable check, and descriptive exception communicate purpose, but parameter names a, b, c and variable d obscure their roles; the docstring explains the callable-class design rather than validation behavior. Code length: The implementation is concise, although imports are disproportionate to the shown functionality. Action granularity: Statements generally perform one action each, and multiline formatting keeps exception construction readable. Reading flow: Validation proceeds naturally from checking callability to constructing and raising an error, followed by representation behavior; cryptic identifiers and unfamiliar decorator options slightly interrupt comprehension.

Run 3

Code Structure: The validator is logically organized into validation and representation methods, though numerous unused imports create clutter. Nesting: Shallow nesting keeps control flow easy to follow. Clarity of intent: The class name, callable check, and exception clearly communicate validation, but parameter names a, b, c and message variable d obscure their roles. The docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, although unused imports and excessive line breaks in formatting add noise. Action granularity: Statements generally perform one action each, with message construction and exception raising clearly separated. Reading flow: Validation proceeds naturally from checking callability to reporting failure; descriptive variable names and cleaner formatting would improve readability.