Sample

pyint-6e76a7a597b2-I04

Replace names with deterministic minifier-style shortest identifiers

Matched original source

Lines28

Scores

MethodScoreScale
Posnett0.0010–1; higher is more readable
Dorn0.8280–1; higher is more readable
Mi0.2470–1; higher is more readable
LLOC17Logical lines; fewer is more readable
DeepSeek V4 Pro15.330–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.5320–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=True, unsafe_hash=True) class _InstanceOfValidator: type = attrib() def __call__(self, a, b, c): """ We use a callable class to be able to change the ``__repr__``. """ if not isinstance(c, self.type): d = f"'{b.name}' must be {self.type!r} (got {c!r} that is a {c.__class__!r})." raise TypeError( d, b, self.type, c, ) def __repr__(self): return f"<instance_of validator for type {self.type!r}>"

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.635.312−20.965
Source linesThe number of non-empty source lines.28+11.2
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.405−6.608

Intercept 8.87 + feature contributions = -7.503 (log-odds).
Score = sigmoid(-7.503) = 0.001.

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.90+0.648
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.05+0.451
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.26+0.162
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.90−0.147
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.27.879−0.02
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.29+0.01

Intercept 0.07 + feature contributions = 1.572 (log-odds).
Score = sigmoid(1.572) = 0.828.

Score0.247
Score17
Run 1

The code demonstrates strong readability. Structure is logical with a single class containing a clear purpose. Nesting is minimal, with only one conditional block. Intent is explicit—a validator checking instance types with a descriptive error message. Code length is concise and focused. Each line generally performs one action. Reading flow is natural, moving from imports to class definition, attributes, validation logic, and a custom repr. Minor deductions: vague parameter names (a, b, c) obscure intent, and the error formatting is slightly dense. The docstring could explain the callable parameters. Overall, these are small issues in otherwise clean code.

Run 2

The code is generally readable with a clear class structure, low nesting, and concise implementation. It uses type hints and docstrings, but several aspects reduce clarity: parameters 'a', 'b', 'c', and variable 'd' are poorly named, obscuring intent; imports are partially unused; and the error message construction lacks explicit clarity. The reading flow is natural, and action granularity is mostly one action per line, but the vague names and unused imports make the purpose harder to discern at a glance.

Run 3

The code is generally readable with clear structure and logical organization. It defines a single class with a clear purpose, using the attrs decorator pattern consistently. Nesting is minimal—only one conditional block inside the __call__ method. The intent is evident: validate that an object is an instance of a specified type. However, readability is slightly reduced by the single-letter parameter names (a, b, c), which obscure the method signature's intent without reading the full implementation. The error message construction is also somewhat dense, packing multiple f-string expressions into one line. The __repr__ method is clear and concise. Overall, the structure is flat and the action granularity is reasonable, though parameter naming and the condensed error formatting could be improved for better clarity and natural reading flow.

Run 1

Code Structure: The class logically groups validation behavior and its representation, though numerous unused imports clutter the snippet. Nesting: Minimal nesting makes control flow easy to follow. Clarity of intent: The class name, isinstance check, and error message communicate the purpose clearly, but parameters a, b, c and temporary variable d obscure their roles. The docstring explains the callable-class design rather than the method's validation behavior. Code length: The implementation is concise, although unused imports and the expanded exception call add visual overhead. Action granularity: Each statement performs a single clear action. Reading flow: Validation proceeds naturally from checking the value to constructing and raising an error, followed by representation logic; descriptive parameter names would improve comprehension.

Run 2

Code Structure: The validator class cleanly separates validation from representation, although numerous unused imports distract from its organization. Nesting: A single conditional keeps control flow shallow and easy to follow. Clarity of intent: The class name, isinstance check, and descriptive error message communicate the purpose, but parameter names a, b, c and temporary variable d obscure their roles. The docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, though unused imports add unnecessary length. Action granularity: Each statement performs one clear action, and the multiline exception construction is readable. Reading flow: The progression from stored type to validation and representation is natural, but cryptic identifiers and limited spacing around the class definition slightly hinder scanning.

Run 3

Code Structure: The validator is logically organized into a field, validation method, and representation method, although unused imports distract. Nesting: A single conditional keeps the code flat and easy to follow. Clarity of intent: The class name, isinstance check, and error message clearly communicate validation behavior, but parameter names a, b, c and temporary variable d obscure their roles. The docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, though the imports and expanded exception arguments add visual overhead. Action granularity: Each statement performs a distinct action, with no crowded compound statements. Reading flow: Validation proceeds naturally from checking the value to constructing and raising an error, followed by a straightforward representation method; clearer naming and import cleanup would improve readability.