Sample

pyint-4dc6565635fd-I11

Split eligible integer literals into pairs of short-named intermediate variables

Matched original source

Lines40

Scores

MethodScoreScale
Posnett0.0010–1; higher is more readable
Dorn0.8560–1; higher is more readable
Mi0.7480–1; higher is more readable
LLOC22Logical lines; fewer is more readable
DeepSeek V4 Pro170–20; mean of three runs
GPT-6.1 Sol16.670–20; mean of three runs
BTTF0.6740–1; higher is more readable

Views

Source code

from __future__ import annotations import abc import contextlib import enum import itertools import linecache import sys import types import unicodedata import weakref from collections.abc import Callable, Mapping from functools import cached_property from typing import Any, NamedTuple, TypeVar from . import _compat, _config, setters from ._compat import ( PY_3_11_PLUS, PY_3_13_PLUS, _AnnotationExtractor, _get_annotations, _lazy_is_generator, get_generic_base, ) from .exceptions import ( DefaultAlreadySetError, FrozenInstanceError, NotAnAttrsClassError, UnannotatedAttributeError, ) @attrs(slots=True, unsafe_hash=True) class _AndValidator: """ Compose many validators to a single one. """ _validators = attrib() def __call__(self, inst, attr, value): for v in self._validators: v(inst, attr, value)

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.765.065−25.247
Source linesThe number of non-empty source lines.40+16
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.657−6.986

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

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.44.829+1.766
Indentation frequencyHow rapidly indentation changes from line to line.38+0.577
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.38−0.451
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.053+0.428
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.41−0.415
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.28.976−0.337
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.39.826+0.147

Intercept 0.07 + feature contributions = 1.785 (log-odds).
Score = sigmoid(1.785) = 0.856.

Score0.748
Score22
Run 1

The code is generally well-structured and follows clear conventions. Imports are organized into logical groups: standard library, third-party/relative, and specific module imports. The module-level import of `attrib`, `attrs`, and `setters` from the package is clear. The `_AndValidator` class has a concise docstring explaining its purpose, and the `__call__` method is easy to follow with a flat loop and a single action per line. The use of `slots=True` and `unsafe_hash=True` is idiomatic for attrs. Minor deductions: the import of `setters` and `attrib` appear without explicit listing in the provided snippet, relying on implicit wildcard or prior context, which could reduce clarity if the reader lacks context. Overall, it is readable, maintainable, and adheres to typical style guides.

Run 2

The code is highly readable, primarily serving as an import and minimal class definition. Structure is clear: standard library imports, third-party/local imports, then a simple class with a docstring and method. Nesting is flat. Intent is explicit—the class composes validators. Length is concise and appropriate for its purpose. Each logical action appears on its own line. The reading flow is natural, moving from imports to class definition and then method logic. Minor deduction only due to the use of an `@attrs` decorator with parameters and `attrib()` without showing their definitions, which could slightly obscure behavior for newcomers. Overall, very clear.

Run 3

The code demonstrates generally good readability with clear structural organization. Imports are logically grouped: standard library, third-party, then local modules with explicit __future__ import placement. The class definition uses a decorator and docstring in conventional order, with a clearly named private class (_AndValidator). The __call__ method is straightforward with a simple loop and one action per line, showing good action granularity. Flat nesting and natural reading flow are evident. Minor deductions include: the large number of imports from _compat could be consolidated, and some imported names (e.g., PY_3_11_PLUS, PY_3_13_PLUS) appear unused in this snippet, adding noise. The variable 'v' in the loop is slightly ambiguous. Overall, clear intent and concise length; clarity could improve with more descriptive naming and removal of unused imports.

Run 1

Code Structure: Imports are grouped logically, and the validator class is small and cohesive, although many imports are unrelated to the shown functionality. Nesting: Minimal nesting—a single loop inside a method—makes execution easy to follow. Clarity of intent: The class name, docstring, and _validators attribute clearly communicate validator composition; abbreviated names such as v and inst slightly reduce clarity. The origins of attrs and attrib are not visible in this snippet. Code length: The implementation is concise, but the extensive import section dominates the excerpt. Action granularity: Each line performs a single clear action. Reading flow: The class progresses naturally from documentation to stored validators to invocation, though the long import preamble delays the relevant logic.

Run 2

Code Structure: Imports and the validator class are logically separated, although many imports are unused in this excerpt and attrs/attrib are not visibly defined or imported. Nesting: Minimal, with only a simple loop inside the callable method. Clarity of intent: The class name and docstring clearly explain validator composition; abbreviated names such as v, inst, and attr slightly reduce clarity. Code length: The implementation is concise, but the extensive import block overwhelms the small class shown. Action granularity: Each statement performs one clear action. Reading flow: The class reads naturally from declaration to stored validators to invocation, though the disproportionate imports and unresolved decorator/helper names interrupt standalone comprehension.

Run 3

Code Structure: Imports are grouped logically, followed by a small, focused validator class, though many imports are unused in this excerpt. Nesting: Minimal nesting makes the execution path easy to follow. Clarity of intent: The class name and docstring clearly explain validator composition, but attrs and attrib are not imported here, and v is less descriptive than validator. Code length: The class is concise, while the extensive import section outweighs the implementation. Action granularity: Each line performs one clear action. Reading flow: The class reads naturally from declaration to stored validators to invocation, although additional spacing between import groups and the class would improve visual organization.