Sample

pyint-4ef5d36a6f0b-I04

Replace names with deterministic minifier-style shortest identifiers

Matched original source

Lines80

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.3650–1; higher is more readable
Mi0.3590–1; higher is more readable
LLOC35Logical lines; fewer is more readable
DeepSeek V4 Pro7.330–20; mean of three runs
GPT-6.1 Sol12.670–20; mean of three runs
BTTF0.4040–1; higher is more readable

Views

Source code

from __future__ import annotations from collections import OrderedDict from collections.abc import Iterable, Iterator, Mapping from typing import Any, Generic, TypeVar, overload from .compat import MutableMapping class CaseInsensitiveDict(MutableMapping[str, _VT], Generic[_VT]): """A case-insensitive ``dict``-like object. Implements all methods and operations of ``MutableMapping`` as well as dict's ``copy``. Also provides ``lower_items``. All keys are expected to be strings. The structure remembers the case of the last key to be set, and ``iter(instance)``, ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()`` will contain case-sensitive keys. However, querying and contains testing is case insensitive:: cid = CaseInsensitiveDict() cid['Accept'] = 'application/json' cid['aCCEPT'] == 'application/json' # True list(cid) == ['Accept'] # True For example, ``headers['content-encoding']`` will return the value of a ``'Content-Encoding'`` response header, regardless of how the header name was originally stored. If the constructor, ``.update``, or equality comparison operations are given keys that have equal ``.lower()``s, the behavior is undefined. """ _store: OrderedDict[str, tuple[str, _VT]] def __init__( self, c: Mapping[str, _VT] | Iterable[tuple[str, _VT]] | None = None, **d: _VT, ) -> None: self._store = OrderedDict() if c is None: c = {} self.update(c, **d) def __setitem__(self, e: str, f: _VT) -> None: # Use the lowercased key for lookups, but store the actual # key alongside the value. self._store[e.lower()] = (e, f) def __getitem__(self, g: str) -> _VT: return self._store[g.lower()][1] def __delitem__(self, h: str) -> None: del self._store[h.lower()] def __iter__(self) -> Iterator[str]: return (i for i, j in self._store.values()) def __len__(self) -> int: return len(self._store) def a(self) -> Iterator[tuple[str, _VT]]: """Like iteritems(), but with all lowercase keys.""" return ((k, l[1]) for (k, l) in self._store.items()) def __eq__(self, m: object) -> bool: if isinstance(m, Mapping): n: CaseInsensitiveDict[Any] = CaseInsensitiveDict(m) # type: ignore[reportUnknownArgumentType] else: return NotImplemented # Compare insensitively return dict(self.a()) == dict(n.lower_items()) # Copy is required def b(self) -> CaseInsensitiveDict[_VT]: return CaseInsensitiveDict(self._store.values()) def __repr__(self) -> str: return str(dict(self.items()))

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.2461.042−81.214
Source linesThe number of non-empty source lines.80+32
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.699−7.048

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.81−1.832
Indentation frequencyHow rapidly indentation changes from line to line.50+0.992
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.106.975+0.922
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.106.975−0.866
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.51−0.749
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.79.917+0.707
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.076+0.203

Intercept 0.07 + feature contributions = -0.552 (log-odds).
Score = sigmoid(-0.552) = 0.365.

Score0.359
Score35
Run 1

The code structure is logically organized with clear class methods, but the readability is severely degraded by the use of meaningless single-letter variable names (e.g., 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n'). This destroys clarity of intent, making it difficult to understand what each parameter or variable represents. The docstring is helpful but cannot compensate for the opaque naming throughout the implementation. Additionally, the method names 'a' and 'b' are completely non-descriptive, and there is a broken reference to 'lower_items' in __eq__ while the method is actually named 'a'. Nesting is flat, and line lengths are mostly reasonable, but the reading flow is disrupted by the cryptic identifiers. Action granularity is acceptable, but the severe naming problems make the code significantly harder to read than necessary.

Run 2

The code implements a case-insensitive dictionary with clear intent from the docstring, but readability suffers from poor naming and structure. Multi-character generic type variables (_VT) and methods with single-letter names (a, b) violate clarity, making them ambiguous. The __eq__ method is nested with type ignores and unclear variable names. The lower_items method is logically okay but renamed 'a' destroys intent. Action granularity is acceptable, but code length is inflated by unhelpful comments and repetitive lowercasing. Reading flow is broken by irregular naming (e, f, g, h, i, j, k, l, m, n) that obscure purpose. Flat nesting is mostly maintained, but the __eq__ conditional creates ambiguity. The code lacks meaningful names and uses unnecessary obfuscation, hence a low score.

Run 3

The code is a mix of clear structure and confusing elements. The class docstring is detailed and helpful, and the overall organization follows a logical MutableMapping pattern with one method per concern, which is good for readability. However, several aspects severely hurt clarity: method and variable names are non-descriptive (e.g., 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'm', 'n'), which obscures intent and makes the reading flow unnatural. The '__eq__' method has an awkward structure and a type-ignore comment that breaks flow. Nesting is generally flat, and line lengths are mostly acceptable, but the generator expressions and multiple operations crammed into some lines reduce action granularity. The class works but reads like obfuscated or minified code, which contradicts the otherwise clean structure.

Run 1

Code Structure: Mapping operations are logically separated into short methods, but the undefined _VT and mismatches between documented and implemented method names undermine coherence. Nesting: Minimal nesting makes control flow easy to follow. Clarity of intent: The class docstring and storage comment explain the design well, but single-letter parameters and methods a/b obscure meaning. The equality method calls lower_items(), although the corresponding method is named a, creating a confusing inconsistency. Code length: Methods are concise; the lengthy docstring provides useful context but references unavailable methods. Action granularity: Statements generally perform one action per line, with compact generator expressions that remain manageable. Reading flow: Standard mapping methods appear in a natural order, but cryptic naming, an unused overload import, and the missing TypeVar definition interrupt comprehension.

Run 2

Code Structure: Methods are logically organized around the mapping interface, with small, focused implementations. Nesting: Minimal branching and no deeply nested blocks make the code easy to scan. Clarity of intent: The class docstring and type annotations explain the design, but single-letter parameters and method names obscure meaning. The documented lower_items and copy methods are named a and b instead, and equality calls the absent lower_items method. The undefined _VT also makes the typing incomplete. Code length: Implementations are concise; the longer docstring provides useful context. Action granularity: Most lines perform one clear operation, although comprehensions require some unpacking mentally. Reading flow: The conventional method sequence supports natural reading, but inconsistent naming and discrepancies between documentation and implementation interrupt comprehension.

Run 3

Code Structure: The class is logically organized into small mapping methods, though _VT is undefined and advertised methods do not match their implementations. Nesting: Minimal nesting makes control flow easy to follow. Clarity of intent: The class docstring and storage comment explain case-insensitive behavior well, but single-letter parameters and method names a and b obscure meaning. Calling lower_items() despite defining a() creates additional confusion. Code length: Methods are concise; the extensive docstring is useful, although unused imports add clutter. Action granularity: Statements generally perform one action per line, with straightforward generator expressions. Reading flow: Familiar mapping-method ordering supports natural reading, but inconsistent naming, missing type-variable declaration, and the mismatch between documentation and code interrupt understanding.