Sample

pyint-971d0316dd39-I04

Replace names with deterministic minifier-style shortest identifiers

Matched original source

Lines66

Scores

MethodScoreScale
Posnett0.0010–1; higher is more readable
Dorn0.6950–1; higher is more readable
Mi0.5350–1; higher is more readable
LLOC29Logical lines; fewer is more readable
DeepSeek V4 Pro14.330–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.7090–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, ) class Factory: """ Stores a factory callable. If passed as the default value to `attrs.field`, the factory is used to generate a new value. Args: factory (typing.Callable): A callable that takes either none or exactly one mandatory positional argument depending on *takes_self*. takes_self (bool): Pass the partially initialized instance that is being initialized as a positional argument. .. versionadded:: 17.1.0 *takes_self* """ __slots__ = ("factory", "takes_self") def __init__(self, a, b=False): self.factory = a self.takes_self = b def __getstate__(self): """ Play nice with pickle. """ return tuple(getattr(self, c) for c in self.__slots__) def __setstate__(self, d): """ Play nice with pickle. """ for e, f in zip(self.__slots__, d, strict=True): setattr(self, e, f)

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.1067.397−35.224
Source linesThe number of non-empty source lines.66+26.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.508−6.762

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.67−1.336
Indentation frequencyHow rapidly indentation changes from line to line.46+0.854
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.46−0.635
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.04+0.552
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.65.872+0.511
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.76.94+0.406
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.74.612+0.399

Intercept 0.07 + feature contributions = 0.822 (log-odds).
Score = sigmoid(0.822) = 0.695.

Score0.535
Score29
Run 1

The code has good structure with clear imports and a well-documented class. The Factory class uses __slots__ efficiently and has reasonable method separation. However, readability is undermined by several factors: poor naming (a, b, c, d, e, f instead of descriptive names like factory and takes_self), inconsistent documentation (docstring says 'factory' and 'takes_self' but parameters are 'a' and 'b'), and the pickle methods use cryptic variable names that obscure intent. The nesting is flat and action granularity is acceptable, but the reading flow breaks when encountering single-letter variables that require mental mapping back to the docstring. The class docstring is helpful but mismatched with the actual implementation, creating ambiguity about what parameters actually represent. Overall, the skeleton is readable but the variable naming choices significantly reduce clarity and maintainability.

Run 2

The code has good overall organization, with clear imports, a well-documented class, and simple methods. However, readability is hurt by the use of non-descriptive parameter names (`a`, `b`) in `Factory.__init__`, which makes intent unclear and reduces self-documentation. The `__getstate__` and `__setstate__` methods use loop-based logic with generic variable names (`c`, `d`, `e`, `f`), making them harder to follow at a glance; a simpler, more explicit approach would improve clarity. The nesting is shallow and action granularity is generally fine, but the lack of meaningful names in key places prevents a higher score.

Run 3

The code is generally well-structured with clear sections: imports, class definition, docstrings, and methods. Nesting is minimal. The Factory class has a clear purpose and its docstring explains both parameters and notes the versionadded tag. However, readability is reduced by cryptic variable names: `a` and `b` in __init__, `c` and `d` in __getstate__/__setstate__, and `e`/`f` in the loop. These single-letter names obscure intent and force the reader to infer meaning from context. The __getstate__/__setstate__ methods use comprehensions and zip, which are concise but could be clearer with explicit assignments. The class itself is short and flat, but the naming choices across methods create unnecessary cognitive load, preventing a higher score.

Run 1

Code Structure: The class is logically organized, with initialization followed by serialization methods, though numerous unused imports clutter the snippet. Nesting: Minimal nesting makes the methods easy to follow. Clarity of intent: The class docstring and descriptive attribute names explain its purpose, but generic parameter and variable names (a–f) obscure meaning; the documented factory and takes_self names also differ from the constructor signature. Code length: The implementation is concise, but the import block is disproportionate to the functionality shown. Action granularity: Statements generally perform one action per line; the generator expression remains compact and understandable. Reading flow: Method ordering is natural, but irrelevant imports and uninformative local names interrupt comprehension.

Run 2

Code Structure: The class logically groups initialization and pickle support, although many imports are unused in this excerpt. Nesting: Methods are flat, with only a single shallow loop. Clarity of intent: The class docstring, descriptive attribute names, and standard method names explain its purpose, but parameters and local variables named a through f obscure meaning; constructor names also do not match the documented arguments. Code length: The implementation is concise, though the extensive import block adds clutter relative to the small class. Action granularity: Statements generally perform one action per line, and the generator expression remains manageable. Reading flow: Methods follow a natural order, but generic variable names require readers to infer relationships, and minimal separation between imports and the class slightly weakens visual organization.

Run 3

Code Structure: The class is logically organized into initialization and serialization methods, but numerous unused imports distract from this snippet. Nesting: Minimal nesting makes control flow easy to follow. Clarity of intent: The class docstring and descriptive attribute names explain its purpose, while single-letter parameters and variables (a through f) obscure meaning; constructor names also fail to match the documented arguments. Code length: The implementation is concise, though the extensive import block is disproportionate to the shown functionality. Action granularity: Each statement performs a focused action, with no crowded multi-statement lines. Reading flow: Methods follow a natural order, but opaque variable names, generic pickle docstrings, and limited spacing between major sections reduce readability.