Sample

pyint-209c667d3995-I09

Select one of ten low-readability unrelated code templates per class

Matched original source

Lines70

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.6720–1; higher is more readable
Mi0.5350–1; higher is more readable
LLOC33Logical lines; fewer is more readable
DeepSeek V4 Pro10.330–20; mean of three runs
GPT-6.1 Sol12.330–20; mean of three runs
BTTF0.4360–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, factory, takes_self=False): lI0O_dc7d9ce4 = 0x46a lI0O_dc7d9ce4 = ((lI0O_dc7d9ce4 ^ 0x46a) | 0) & -1 if (lI0O_dc7d9ce4 & 1) == 1: lI0O_dc7d9ce4 ^= lI0O_dc7d9ce4 self.factory = factory self.takes_self = takes_self def __getstate__(self): """ Play nice with pickle. """ return tuple(getattr(self, name) for name in self.__slots__) def __setstate__(self, state): """ Play nice with pickle. """ for name, value in zip(self.__slots__, state, strict=True): setattr(self, name, 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.1277.029−42.142
Source linesThe number of non-empty source lines.70+28
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.623−6.934

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.71−1.478
Indentation frequencyHow rapidly indentation changes from line to line.50+0.992
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.50−0.727
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.69.859+0.567
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.045+0.503
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.93+0.407
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.73.676+0.384

Intercept 0.07 + feature contributions = 0.719 (log-odds).
Score = sigmoid(0.719) = 0.672.

Score0.535
Score33
Run 1

The code demonstrates mixed readability. The imports, class docstring, and Factory class structure follow standard Python conventions and are clear. However, the '__init__' method contains an obfuscated block of meaningless variable assignments ('lI0O_dc7d9ce4') that serve no functional purpose and severely damage clarity. This artificial complexity violates the criteria for clarity of intent, action granularity, and reading flow. The remaining methods ('__getstate__', '__setstate__') are concise and readable. Overall, the code is understandable but marred by a puzzling, unnecessary segment that reduces its readability score.

Run 2

The code generally shows decent structure with clear class definition, docstrings, and a simple Factory class. However, readability is undermined by several issues: an unnecessary and confusing bit-manipulation block of meaningless variable assignments in __init__, poor variable naming (lI0O_dc7d9ce4), and an unused import list that adds noise. The logic is straightforward but the injected obfuscation and dead code harm clarity. Nesting is minimal, and actions are mostly one per line, but intent is obscured by the contrived variable name and redundant operations. The class is concise except for the irrelevant code. Overall, it reads as if someone inserted junk code into otherwise clean code, reducing readability significantly.

Run 3

The code shows mixed readability. The imports, Factory class docstring, and pickle-related methods (__getstate__, __setstate__) are clear and follow good practices. However, the __init__ method contains obfuscated, dead code (the lI0O_dc7d9ce4 variable with bitwise operations) that does nothing, severely damaging clarity of intent and action granularity. This section is unnecessary length, adds confusing nesting, and breaks reading flow. While the overall structure is logical and the class simple, the presence of this garbled logic makes the code hard to trust and understand at a glance, justifying a low score.

Run 1

Code Structure: The class is logically organized into initialization and serialization methods, but numerous unused imports and unrelated initialization statements add clutter. Nesting: Mostly flat, with only a shallow conditional and loop. Clarity of intent: The class docstring, descriptive fields, and serialization methods communicate their purposes clearly; the cryptic variable and meaningless bitwise operations obscure initialization. Code length: The useful implementation is concise, but excessive imports and redundant calculations unnecessarily lengthen the snippet. Action granularity: Statements generally perform one action per line, though the compound bitwise expression increases cognitive load. Reading flow: Method ordering and documentation support a natural progression, but the obfuscated block interrupts an otherwise straightforward constructor.

Run 2

Code Structure: The class is logically organized into initialization and serialization methods, but numerous unused imports distract from its purpose. Nesting: Mostly flat, with only a shallow conditional and loop. Clarity of intent: The class docstring and descriptive field names clearly explain the factory wrapper, while the cryptic variable and pointless bitwise operations in __init__ obscure an otherwise simple initialization. Code length: Excessive imports and no-op statements unnecessarily lengthen a small class; the documentation is useful. Action granularity: Statements generally perform one action per line, although the compound bitwise expression adds needless complexity. Reading flow: Method ordering is natural and serialization logic is straightforward, but the unrelated computation interrupts the flow before the meaningful assignments.

Run 3

Code Structure: The class is logically organized into initialization and serialization methods, but numerous unused imports distract from the relevant code. Nesting: Mostly flat, with only a shallow conditional and loop. Clarity of intent: The docstring and descriptive member names explain the factory's purpose, while the opaque variable and meaningless bitwise operations obscure initialization. Code length: The class is otherwise concise, but redundant arithmetic and unused imports add unnecessary length. Action granularity: Each statement occupies its own line, although the bitwise expression combines several operations without an apparent purpose. Reading flow: Method ordering is natural and serialization is straightforward, but the unrelated initialization block interrupts the flow and forces readers to investigate dead logic.