Sample

pyint-970abc183d98-I04

Replace names with deterministic minifier-style shortest identifiers

Matched original source

Lines21

Scores

MethodScoreScale
Posnett0.0010–1; higher is more readable
Dorn0.7060–1; higher is more readable
Mi0.5250–1; higher is more readable
LLOC16Logical lines; fewer is more readable
DeepSeek V4 Pro150–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.6260–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 _OptionalValidator: validator = attrib() def __call__(self, a, b, c): if c is None: return self.validator(a, b, c) def __repr__(self): return f"<optional validator for {self.validator!r} or None>"

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.546.833−18.045
Source linesThe number of non-empty source lines.21+8.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.517−6.775

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
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+0.743
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.062+0.34
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.22+0.257
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.20.929−0.117
Indentation frequencyHow rapidly indentation changes from line to line.21−0.011

Intercept 0.07 + feature contributions = 0.876 (log-odds).
Score = sigmoid(0.876) = 0.706.

Score0.525
Score16
Run 1

The code is generally well-structured and readable. It uses clear imports, context managers, and attrs-based class definition. The class `_OptionalValidator` has a single responsibility with a concise `__call__` method and a readable `__repr__`. Nesting is minimal, and the reading flow is natural. Minor points: the `__call__` parameters are opaque (`a, b, c`) which slightly reduces clarity, and the `c is None` check is fine but the purpose could be documented more explicitly. Overall very clean for a utility class.

Run 2

The code is reasonably structured but has clarity issues. The class definition is concise and flat, but the `__call__` method uses opaque parameter names (`a`, `b`, `c`) that obscure intent — the reader cannot tell what each argument represents without inspecting the calling context. The early-return guard for `if c is None` is good, but the final line performs two actions: calling the validator and returning implicitly, which slightly reduces action granularity. The import block is mostly clear but includes an unused `operator`, `re`, `Pattern`, and `default_if_none`, which adds noise. The `__repr__` method is clean. Overall, the code is short and flat, but variable naming and unused imports lower readability.

Run 3

The code is generally well-structured and readable. It uses clear imports, a decorator for class configuration, and a single class with a focused responsibility. Nesting is minimal, and the `__call__` method is flat with an early return for the `None` case. The intent is clear: wrap a validator to make it optional. The code is concise, with no unnecessary verbosity. Action granularity is mostly one action per line. The reading flow is natural. Minor deductions: the parameter names `a, b, c` are opaque and reduce clarity of intent, and the `__repr__` string is slightly complex but still understandable.

Run 1

Code Structure: Imports and a small, focused validator class are logically organized, though several imports are unused in the shown snippet. Nesting: Minimal nesting and an early return make execution easy to follow. Clarity of intent: The class name and representation clearly communicate optional validation, but parameter names a, b, and c obscure their roles. Code length: The implementation is concise without unnecessary logic. Action granularity: Each line performs one clear action. Reading flow: The progression from declaration to validation behavior to representation is natural, with useful spacing; more descriptive parameter names would improve readability.

Run 2

Code Structure: Imports and a small validator class are logically organized, although several imports appear unused in this snippet. Nesting: The call method is flat, using an early return rather than nested conditionals. Clarity of intent: The class name and representation clearly convey optional validation, but parameter names a, b, and c obscure their roles. Code length: The class is concise without unnecessary implementation detail. Action granularity: Each statement performs a single action. Reading flow: The progression from declaration to validation behavior to representation is natural, with whitespace separating methods and the early-return case. More descriptive parameter names and removal of unused imports would improve readability.

Run 3

Code Structure: The class is logically organized, separating validation behavior from representation, though numerous unused imports add clutter. Nesting: Minimal nesting and an early return make execution easy to follow. Clarity of intent: The class name and representation clearly communicate optional validation, but parameter names a, b, and c obscure their roles, and the decorator options require framework knowledge. Code length: The implementation is concise, although the imports are excessive for this snippet. Action granularity: Each statement performs one action, with no compressed multi-action lines. Reading flow: The flow from declaration to validation to representation is natural, aided by whitespace; grouping imports and adding spacing before the class decorator would improve presentation.