Sample

pyint-a8714daeae25-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines66

Scores

MethodScoreScale
Posnett0.0010–1; higher is more readable
Dorn0.6970–1; higher is more readable
Mi0.5350–1; higher is more readable
LLOC29Logical lines; fewer is more readable
DeepSeek V4 Pro40–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.6240–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, session, currentKey=False): self.factory = session self.takes_self = currentKey def __getstate__(self): """ Play nice with pickle. """ return tuple(getattr(self, size) for size in self.__slots__) def __setstate__(self, price): """ Play nice with pickle. """ for item, batch in zip(self.__slots__, price, strict=True): setattr(self, item, batch)

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.524−6.786

Intercept 8.87 + feature contributions = -6.74 (log-odds).
Score = sigmoid(-6.74) = 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.039+0.566
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.65.833+0.51
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.77+0.404
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.833 (log-odds).
Score = sigmoid(0.833) = 0.697.

Score0.535
Score29
Run 1

The code appears to be a heavily obfuscated version of attrs' Factory class with deliberately scrambled naming. While the overall structure shows logical sections (imports, class definition, methods), parameter names like 'session', 'currentKey', 'price' are meaningless in context and reveal intentional misdirection. The __getstate__/__setstate__ methods iterate over __slots__ but use confusing variable names ('size', 'batch') that obscure their purpose. The class level has minimal nesting, but the code fails catastrophically on clarity of intent - the docstring describes a Factory callable storage, yet parameter names suggest pricing/session management. Action granularity is generally one action per line, aiding readability slightly, but the semantic mismatch between documented purpose and actual naming destroys comprehension. The reading flow is disrupted by the constant mental translation required to map misleading names to their likely intended counterparts (e.g., 'session' to 'factory', 'currentKey' to 'takes_self'). Overall, this code is readable only in structure, not intent.

Run 2

The code fails on nearly all readability criteria. The imports are disorganized and include many unused modules. The Factory class docstring describes a legitimate API with 'factory' and 'takes_self' parameters, but the __init__ signature uses meaningless, obfuscated names ('session', 'currentKey') that contradict the documented intent. Parameter naming in __getstate__ and __setstate__ is nonsensical ('size' for attribute names, 'price' for state, 'batch' for values), making the code impossible to follow. The __getstate__ method uses a tuple comprehension over __slots__ in one line, violating action granularity and reading flow. The overall structure is simple only because it is largely empty, but the disconnection between documentation and implementation, combined with misleading identifiers, creates severe ambiguity. This is a textbook example of how poor naming and inconsistent structure can render even short code unreadable.

Run 3

The code is a poorly obfuscated version of a clear original (likely 'attrs' library). Naming is misleading: session/currentKey/price/batch replace factory/takes_self/state/value, destroying clarity of intent. The core logic is simple but wrapped in irrelevant imports and docstrings that contradict the actual variable names. Structure is flat but disjointed; reading flow is confusing due to semantically wrong identifiers. Length is excessive for the trivial functionality shown, and comments like 'Play nice with pickle' do not align with actual behavior. Action granularity is acceptable, but readability collapses because every meaningful name has been replaced with unrelated terms, making the purpose ambiguous and the code effectively unmaintainable.

Run 1

Code Structure: The class is logically organized into initialization and serialization methods, but the many unused imports clutter this snippet. Nesting: Methods are flat, with only a simple loop and comprehension. Clarity of intent: The class docstring and attribute names explain the factory's purpose, but parameter and local names such as session, currentKey, price, size, and batch are misleading and inconsistent with that purpose. Code length: The implementation is concise, although the imports and extensive documentation outweigh the small amount of functional code. Action granularity: Each statement performs one clear action; the comprehension remains straightforward. Reading flow: Method order is natural, but unrelated imports and mismatched naming interrupt comprehension and force readers to mentally translate variables.

Run 2

Code Structure: Imports and a single, focused class are logically organized, though many imports are unused in this snippet. Nesting: Methods are shallow, with only one simple loop. Clarity of intent: The class docstring and slot names explain the factory's purpose, but unrelated parameter names such as session, currentKey, and price, plus loop names size, item, and batch, obscure their roles. The constructor names also conflict with the documented factory and takes_self arguments. Code length: Implementation is concise, although imports and documentation dominate this small snippet. Action granularity: Statements generally perform one action per line; the generator expression is compact and manageable. Reading flow: Method order is natural, moving from initialization to serialization, but misleading names and mixed naming conventions interrupt comprehension.

Run 3

Code Structure: Imports and a small, self-contained class are logically organized, although many imports are unused in this snippet. Nesting: Minimal nesting makes the methods easy to follow. Clarity of intent: The class docstring clearly explains the factory concept, but parameter names such as session, currentKey, and price contradict their roles and the documented factory/takes_self API. Generic loop names such as size, item, and batch also obscure meaning. Code length: The implementation is concise, though the extensive imports and documentation outweigh the small amount of executable code. Action granularity: Statements generally perform one action per line; the generator expression remains manageable. Reading flow: The conventional class layout and short methods support natural reading, but inconsistent naming and the mismatch between documentation and constructor parameters interrupt comprehension.