Sample

pyint-9e92bbef88f9-I04

Replace names with deterministic minifier-style shortest identifiers

Matched original source

Lines270

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.1130–1; higher is more readable
Mi0.5830–1; higher is more readable
LLOC73Logical lines; fewer is more readable
DeepSeek V4 Pro4.330–20; mean of three runs
GPT-6.1 Sol10.330–20; mean of three runs
BTTF0.4230–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 Attribute: """ *Read-only* representation of an attribute. .. warning:: You should never instantiate this class yourself. The class has *all* arguments of `attr.ib` (except for ``factory`` which is only syntactic sugar for ``default=Factory(...)`` plus the following: - ``name`` (`str`): The name of the attribute. - ``alias`` (`str`): The __init__ parameter name of the attribute, after any explicit overrides and default private-attribute-name handling. - ``alias_is_default`` (`bool`): Whether the ``alias`` was automatically generated (``True``) or explicitly provided by the user (``False``). - ``inherited`` (`bool`): Whether or not that attribute has been inherited from a base class. - ``eq_key`` and ``order_key`` (`typing.Callable` or `None`): The callables that are used for comparing and ordering objects by this attribute, respectively. These are set by passing a callable to `attr.ib`'s ``eq``, ``order``, or ``cmp`` arguments. See also :ref:`comparison customization <custom-comparison>`. Instances of this class are frequently used for introspection purposes like: - `fields` returns a tuple of them. - Validators get them passed as the first argument. - The :ref:`field transformer <transform-fields>` hook receives a list of them. - The ``alias`` property exposes the __init__ parameter name of the field, with any overrides and default private-attribute handling applied. .. versionadded:: 20.1.0 *inherited* .. versionadded:: 20.1.0 *on_setattr* .. versionchanged:: 20.2.0 *inherited* is not taken into account for equality checks and hashing anymore. .. versionadded:: 21.1.0 *eq_key* and *order_key* .. versionadded:: 22.2.0 *alias* .. versionadded:: 26.1.0 *alias_is_default* For the full version history of the fields, see `attr.ib`. """ # These slots must NOT be reordered because we use them later for # instantiation. __slots__ = ( # noqa: RUF023 "name", "default", "validator", "repr", "eq", "eq_key", "order", "order_key", "hash", "init", "metadata", "type", "converter", "kw_only", "inherited", "on_setattr", "alias", "alias_is_default", ) def __init__( self, d, e, f, g, h, # XXX: unused, remove along with other cmp code. i, j, k, l=None, m=None, n=None, o=False, p=None, q=None, r=None, s=None, t=None, u=None, v=None, ): p, q, r, s = _determine_attrib_eq_order( h, q or p, s or r, True ) # Cache this descriptor here to speed things up later. w = _OBJ_SETATTR.__get__(self) # Despite the big red warning, people *do* instantiate `Attribute` # themselves. w("name", d) w("default", e) w("validator", f) w("repr", g) w("eq", p) w("eq_key", q) w("order", r) w("order_key", s) w("hash", i) w("init", j) w("converter", n) w( "metadata", ( types.MappingProxyType(dict(l)) # Shallow copy if l else _EMPTY_METADATA_SINGLETON ), ) w("type", m) w("kw_only", o) w("inherited", k) w("on_setattr", t) w("alias", u) w( "alias_is_default", u is None if v is None else v, ) def __setattr__(self, x, y): raise FrozenInstanceError @classmethod def a( cls, z: str, A: _CountingAttr, B: bool, C=None ): # The 'kw_only' argument is the class-level setting, and is used if the # attribute itself does not explicitly set 'kw_only'. # type holds the annotated value. deal with conflicts: if C is None: C = A.type elif A.type is not None: D = f"Type annotation and type argument cannot both be present for '{z}'." raise ValueError(D) return cls( z, A._default, A._validator, A.repr, None, A.hash, A.init, False, A.metadata, C, A._converter, B if A.kw_only is None else A.kw_only, A.eq, A.eq_key, A.order, A.order_key, A.on_setattr, A.alias, A.alias is None, ) # Don't use attrs.evolve since fields(Attribute) doesn't work def b(self, **E): """ Copy *self* and apply *changes*. This works similarly to `attrs.evolve` but that function does not work with :class:`attrs.Attribute`. It is mainly meant to be used for `transform-fields`. .. versionadded:: 20.3.0 """ import copy F = copy.copy(self) F._setattrs(E.items()) if "alias" in E and "alias_is_default" not in E: # Explicit alias provided -- no longer the default. _OBJ_SETATTR.__get__(F)("alias_is_default", False) elif ( "name" in E and "alias" not in E # Don't auto-generate alias if the user picked picked the old one. and self.alias_is_default ): # Name changed, alias was auto-generated -- update it. _OBJ_SETATTR.__get__(F)( "alias", _default_init_alias_for(F.name) ) return F # Don't use _add_pickle since fields(Attribute) doesn't work def __getstate__(self): """ Play nice with pickle. """ return tuple( getattr(self, G) if G != "metadata" else dict(self.metadata) for G in self.__slots__ ) def __setstate__(self, H): """ Play nice with pickle. """ if len(H) < len(self.__slots__): # Pre-26.1.0 pickle without alias_is_default -- infer it # heuristically. I = dict(zip(self.__slots__, H, strict=False)) J = I.get( "alias" ) is None or I.get("alias") == _default_init_alias_for( I["name"] ) H = (*H, J) self.c(zip(self.__slots__, H, strict=True)) def c(self, K): L = _OBJ_SETATTR.__get__(self) for M, N in K: if M != "metadata": L(M, N) else: L( M, ( types.MappingProxyType(dict(N)) if N else _EMPTY_METADATA_SINGLETON ), )

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.5686.409−187.651
Source linesThe number of non-empty source lines.270+108
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.358−6.537

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.271−8.559
Indentation frequencyHow rapidly indentation changes from line to line.196+6.042
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.196−4.077
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.269.92+3.363
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.85.956+0.582
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.046+0.495
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.85.937+0.025

Intercept 0.07 + feature contributions = -2.057 (log-odds).
Score = sigmoid(-2.057) = 0.113.

Score0.583
Score73
Run 1

The code is severely hampered by intentionally obfuscated naming (single letters like d, e, f, w, a, b, c, L, M, N) that obscures the purpose of parameters, variables, and methods. While the class structure is logical and the docstrings are clear, the implementation details are incomprehensible without detective work. Nesting is minimal and action granularity is reasonable (one operation per line), but the code length is excessive due to cryptic variable names forcing mental mapping. The reading flow is broken because readers must constantly cross-reference the __slots__ ordering and decoder-ring letter assignments to understand what each line does. The Attribute class's public API is somewhat documented, but private helpers and constructor parameters lack semantic clarity, making maintenance and review unnecessarily difficult despite the straightforward logic underneath.

Run 2

This code is severely unreadable. The use of single-letter variable names (d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N) completely obscures the meaning of parameters and locals. There is no logical naming convention, making it nearly impossible to infer intent. The __init__ method accepts 19 positional parameters with no descriptive names, and the classmethod 'a' is equally cryptic. Nesting is moderate but combined with obfuscated names and unexplained magic values it is impenetrable. While docstrings are present, they do not compensate for the lack of semantic naming. The code length is excessive given the obfuscation, and reading flow is broken by constant mental translation of letters to imagined meanings. Action granularity is acceptable per line but meaningless due to naming.

Run 3

The code is extremely unreadable due to deliberate obfuscation of variable names, parameters, and methods. Instead of descriptive names like 'name' or 'alias', it uses single letters (d, e, f, g, h) and meaningless method names (a, b, c). This makes the purpose of each argument and operation ambiguous and requires constant cross-referencing with documentation. The class has good documentation and logical structure with slots and methods grouped, and nesting is flat, but these positives are negated by the cryptic naming. Actions are mostly one per line, but reading flow is severely disrupted by having to map letters to meanings. Code length is reasonable, but readability collapses due to lack of clear intent and absurd parameter naming.

Run 1

Code Structure: The class is logically divided into initialization, copying, serialization, and attribute-setting methods, but slot-order dependencies and the apparent mismatch between _setattrs and method c complicate understanding. Nesting: Mostly shallow, with manageable conditionals and loops. Clarity of intent: Descriptive slot names, comments, and docstrings help, but single-letter parameters, variables, and method names severely obscure behavior and positional argument mappings. Code length: Repetitive initialization and extensive documentation increase length; much is justified, though awkward wrapping adds noise. Action granularity: Most lines perform one action, but tuple assignment and nested expressions occasionally require extra parsing. Reading flow: Method organization is natural, yet readers must repeatedly translate opaque identifiers and trace long positional calls, substantially disrupting flow.

Run 2

Code Structure: Methods separate initialization, copying, serialization, and assignment logically, but positional constructor arguments and slot-order dependencies create fragile coupling. Nesting: Mostly shallow, with straightforward conditionals and loops. Clarity of intent: Documentation, comments, and descriptive slot names help, but single-letter parameters, variables, and method names severely obscure meaning. The call to _setattrs despite the visible helper being named c also confuses readers. Code length: Generally reasonable for the functionality, though lengthy documentation and repetitive initialization increase scanning effort. Action granularity: Most lines perform one action; tuple unpacking and conditional expressions introduce modest density. Reading flow: Method organization is natural, but tracing anonymous arguments through a long constructor call and navigating awkward line wrapping frequently interrupts comprehension.

Run 3

Code Structure: Methods logically separate initialization, copying, serialization, and attribute updates, but slot-order dependencies and long positional calls create coupling. Nesting: Mostly shallow, with modest conditionals and loops; multiline expressions add some visual complexity. Clarity of intent: Detailed documentation, descriptive slot names, and explanatory comments help, but single-letter parameters, variables, and methods severely obscure meaning. The call to _setattrs despite the visible update method being named c also interrupts understanding. Code length: Repetitive initialization and extensive documentation make the class lengthy, although most operations serve a distinct purpose. Action granularity: Generally one action per line, with a few compact tuple assignments and conditional expressions requiring additional interpretation. Reading flow: Method organization is natural, but tracing positional arguments, decoding anonymous identifiers, and navigating awkward line wrapping substantially increase reading effort.