Sample

pyint-e1a401b8f001-I04

Replace names with deterministic minifier-style shortest identifiers

Matched original source

Lines31

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8750–1; higher is more readable
Mi0.6690–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro10.670–20; mean of three runs
GPT-6.1 Sol14.670–20; mean of three runs
BTTF0.4950–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 _InValidator: options = attrib() _original_options = attrib(hash=False) def __call__(self, a, b, c): try: d = c in self.options except TypeError: # e.g. `1 in "abc"` d = False if not d: e = f"'{b.name}' must be in {self._original_options!r} (got {c!r})" raise ValueError( e, b, self._original_options, c, ) def __repr__(self): return f"<in_ validator with options {self._original_options!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.737.534−24.339
Source linesThe number of non-empty source lines.31+12.4
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.361−6.541

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.79+0.47
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.054+0.421
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
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.969+0.32
Indentation frequencyHow rapidly indentation changes from line to line.30+0.301
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.31−0.061
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.30.95+0.023

Intercept 0.07 + feature contributions = 1.942 (log-odds).
Score = sigmoid(1.942) = 0.875.

Score0.669
Score20
Run 1

The code is generally readable with a clear structure and flat nesting. The validator class has a straightforward purpose, and the use of attrs is idiomatic. However, the use of single-letter variable names (a, b, c, d, e) significantly hurts clarity of intent — it's not obvious what these represent without external knowledge of the attrs validator interface. The error message construction is fragmented, and the TypeError handling is concise but cryptic. The flat structure and short method are positives, but the naming choices and terse style prevent higher readability. Action granularity is reasonable, though the error handling and validation logic are somewhat compressed. Overall, the code is functional but would benefit from descriptive variable names and clearer separation of concerns within the __call__ method.

Run 2

The code is functional but suffers from poor readability due to cryptic naming (a, b, c, d, e) and compressed logic. While the structure is logical and flat, the intent is obscured by single-letter variables and terse exception handling. The try/except block mixes error handling with assignment, and the conditional in the except clause ('e.g. 1 in "abc"') is helpful but misplaced. The action granularity is reasonable (mostly one action per line), but the reading flow is disrupted by having to decode variable meanings. The repr method is clear, but the overall code length is slightly longer than necessary due to the awkward variable naming. Using descriptive names like 'attribute', 'value', 'contains' would significantly improve clarity.

Run 3

The code suffers from poor readability due to cryptic variable names (a, b, c, d, e), ambiguous parameter naming, and unconventional structure. While the overall class organization is logical, the single-letter variables obscure the intent completely, making it hard to understand what each parameter represents. The nesting is minimal, which is good, but the action granularity is inconsistent - some lines contain multiple operations while others are overly spread out. The reading flow is disrupted by the unclear variable names, though the validator pattern is recognizable. The code is concise but at the cost of clarity. The error message construction is clear, but the logic around the 'in' check with TypeError handling is obscured by poor naming. Overall, this code would be difficult to maintain or debug without significant context or documentation explaining what each variable represents.

Run 1

Code Structure: The class is logically organized into attributes, validation, and representation, though several imports are unused in this snippet. Nesting: Shallow try/except and a single conditional make control flow easy to follow. Clarity of intent: Membership validation is apparent from the class name, expression, and error message, but parameters a, b, c and variables d, e obscure their roles. Code length: The implementation is concise, although unused imports add noise and the multiline exception construction is somewhat verbose. Action granularity: Statements generally perform one action per line, making individual operations easy to inspect. Reading flow: The progression from membership check to failure handling is natural, and the TypeError comment is helpful; cryptic names and framework-specific decorators slightly interrupt comprehension.

Run 2

Code Structure: The class is logically organized into attributes, validation, and representation, but numerous unused imports add clutter. Nesting: Shallow try/except and a single conditional keep the control flow easy to follow. Clarity of intent: Membership validation is recognizable, and the error message is informative, but parameter and local names a, b, c, d, and e obscure their roles. Code length: The implementation is concise, although the imports and expanded exception arguments add visual overhead. Action granularity: Each line generally performs one action, making execution straightforward to track. Reading flow: Validation proceeds naturally from membership checking to error reporting; cryptic names and unexplained decorator settings slightly interrupt comprehension.

Run 3

Code Structure: The class is logically organized into attributes, validation, and representation, though several unused imports add clutter. Nesting: Shallow try/except and a single conditional make control flow easy to follow. Clarity of intent: Membership validation is recognizable, but parameter names a, b, c and local names d, e obscure their roles; a is unused. Code length: The implementation is concise, although the import block is disproportionate to the shown functionality. Action granularity: Statements generally perform one action each, and the multiline exception construction is readable. Reading flow: Validation proceeds naturally from membership testing to error reporting, supported by a useful TypeError comment. More descriptive names and removal of unused imports would significantly improve readability.