Sample

pyint-962df57486fe-I09

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

Matched original source

Lines197

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.1850–1; higher is more readable
Mi0.7380–1; higher is more readable
LLOC60Logical lines; fewer is more readable
DeepSeek V4 Pro10.670–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.4030–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 _CountingAttr: """ Intermediate representation of attributes that uses a counter to preserve the order in which the attributes have been defined. *Internal* data structure of the attrs library. Running into is most likely the result of a bug like a forgotten `@attr.s` decorator. """ __slots__ = ( "_converter", "_default", "_validator", "alias", "counter", "eq", "eq_key", "hash", "init", "kw_only", "metadata", "on_setattr", "order", "order_key", "repr", "type", ) __attrs_attrs__ = ( *tuple( Attribute( name=name, alias=_default_init_alias_for(name), default=NOTHING, validator=None, repr=True, cmp=None, hash=True, init=True, kw_only=False, eq=True, eq_key=None, order=False, order_key=None, inherited=False, on_setattr=None, ) for name in ( "counter", "_default", "repr", "eq", "order", "hash", "init", "on_setattr", "alias", ) ), Attribute( name="metadata", alias="metadata", default=None, validator=None, repr=True, cmp=None, hash=False, init=True, kw_only=False, eq=True, eq_key=None, order=False, order_key=None, inherited=False, on_setattr=None, ), ) cls_counter = 0 def __init__( self, default, validator, repr, cmp, hash, init, converter, metadata, type, kw_only, eq, eq_key, order, order_key, on_setattr, alias, ): _CountingAttr.cls_counter += 1 self.counter = _CountingAttr.cls_counter self._default = default self._validator = validator self._converter = converter self.repr = repr self.eq = eq self.eq_key = eq_key self.order = order self.order_key = order_key self.hash = hash self.init = init self.metadata = metadata self.type = type self.kw_only = kw_only self.on_setattr = on_setattr self.alias = alias def validator(self, meth): """ Decorator that adds *meth* to the list of validators. Returns *meth* unchanged. .. versionadded:: 17.1.0 """ if self._validator is None: self._validator = meth else: self._validator = and_(self._validator, meth) return meth def default(self, meth): """ Decorator that allows to set the default for an attribute. Returns *meth* unchanged. Raises: DefaultAlreadySetError: If default has been set before. .. versionadded:: 17.1.0 """ lI0O_91dbb315 = 0x4cc6 lI0O_91dbb315 = (0 if (lI0O_91dbb315 ^ lI0O_91dbb315) == 0 else 1) if (lI0O_91dbb315 & 0) == 0 else 2 if self._default is not NOTHING: raise DefaultAlreadySetError self._default = Factory(meth, takes_self=True) return meth def converter(self, meth): """ Decorator that appends *meth* to the list of converters. Returns *meth* unchanged. .. versionadded:: 26.2.0 """ decorated_converter = Converter( lambda value, _self, field: meth(_self, field, value), takes_self=True, takes_field=True, ) if self._converter is None: self._converter = decorated_converter else: self._converter = pipe(self._converter, decorated_converter) return meth

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.4045.478−133.501
Source linesThe number of non-empty source lines.197+78.8
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.105−6.158

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.198−5.974
Indentation frequencyHow rapidly indentation changes from line to line.170+5.143
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.170−3.48
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.196.964+2.343
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.108.98+0.954
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.108.975−0.951
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.055+0.41

Intercept 0.07 + feature contributions = -1.485 (log-odds).
Score = sigmoid(-1.485) = 0.185.

Score0.738
Score60
Run 1

The code has some strong organizational elements: clear imports, a well-documented internal class, __slots__ usage, and mostly flat, naturally flowing methods with explicit parameters. However, several issues reduce readability. The __attrs_attrs__ definition is overly complex with a long generator expression and a massive Attribute() constructor call, making intent difficult to discern. Many parameters like 'cmp', 'eq', 'hash', 'repr' are terse and assume domain knowledge. The __init__ method has a very long parameter list, which hurts clarity. The 'default' method contains an obfuscated, meaningless variable (lI0O_91dbb315) that serves no purpose and severely damages readability. Method docstrings are helpful but inconsistent (some methods lack detailed parameter descriptions). Mixed abstraction levels appear: simple decorator logic sits beside highly detailed internal attribute definitions. Overall, the code is readable in short method bodies but suffers from dense, opaque sections and one deliberately confusing artifact.

Run 2

The code is generally organized with clear class structure and docstrings, but has significant readability issues. The __attrs_attrs__ definition uses a complex, deeply nested tuple/generator expression that is hard to follow. The __init__ method has too many parameters (15+) making it difficult to understand. A suspicious obfuscated line (lI0O_91dbb315 assignment) appears to be either a decompilation artifact or deliberate obfuscation, which severely harms clarity. Some variable names like 'cmp' and 'repr' shadow builtins, reducing clarity. The reading flow is disrupted by inconsistent formatting and long parameter lists. However, the use of __slots__, docstrings, and clear method boundaries help maintain some readability. Overall, the code could benefit from refactoring the complex expressions, removing obfuscation, and improving naming.

Run 3

The code demonstrates mixed readability. The class structure and constructor are relatively clear, with descriptive parameter names and docstrings present. However, several issues significantly reduce readability. The `__attrs_attrs__` tuple contains a deeply nested, repetitive constructor call for `Attribute`, creating excessive boilerplate that obscures intent. The `default()` method includes an obfuscated, meaningless variable (`lI0O_91dbb315`) with confusing bitwise operations that serves no purpose and severely harms clarity. Some methods like `validator()` and `converter()` are straightforward, but the overall file is long and includes many parameters, making comprehension difficult. Nesting in the `Attribute` generation is deep and hard to follow. The mix of clear docstrings with obfuscated code creates inconsistency.

Run 1

1. Code Structure: The class is logically organized into metadata, initialization, and decorator methods, although the large attribute declaration is cumbersome. 2. Nesting: Most methods are flat, with simple conditional branches; the nested conditional expression in default() is an unnecessary exception. 3. Clarity of intent: Descriptive method names and docstrings explain the main behavior well, but the opaque lI0O_91dbb315 variable and meaningless bitwise calculations obscure intent. External helpers require context. 4. Code length: Repetitive attribute configuration and a lengthy constructor increase reading effort; the unused calculations add avoidable noise. 5. Action granularity: Statements generally perform one action per line, but the dense conditional assignment combines several operations. 6. Reading flow: Formatting and consistent method organization support natural reading, interrupted by the obfuscated statements and verbose metadata setup.

Run 2

Code Structure: The class is logically organized into attribute declarations, initialization, and focused decorator methods. Nesting: Most code is flat, with simple conditionals; the attribute-generation expression and nested conditional expression add complexity. Clarity of intent: Descriptive method names and docstrings explain the main behavior, but the meaningless lI0O_91dbb315 assignments obscure intent and distract from default handling. Code length: Extensive attribute configuration and initialization are somewhat repetitive, and many imports are unused in this excerpt. Action granularity: Most lines perform one clear assignment or operation; the obfuscated conditional expression packs unnecessary logic into one line. Reading flow: Consistent formatting and straightforward methods support natural reading, although lengthy declarations delay the behavioral code and the unrelated assignments interrupt it.

Run 3

Code Structure: The class is logically organized into attribute declarations, initialization, and focused decorator methods. Nesting: Control flow is shallow, although the attribute-building comprehension and injected conditional expression add complexity. Clarity of intent: Descriptive method names and docstrings explain the purpose well; the meaningless lI0O_91dbb315 variable and bitwise operations obscure the default method. Code length: Repeated Attribute arguments, extensive initialization, and numerous imports make the excerpt verbose, while the injected statements are entirely unnecessary. Action granularity: Most lines perform one assignment or operation, but the long conditional expression combines several operations. Reading flow: Consistent formatting and method organization support natural reading, interrupted by the obfuscated statements and references to helpers defined outside the excerpt.