Sample

pyint-c5639f6f2a52-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines100

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.2330–1; higher is more readable
Mi0.4710–1; higher is more readable
LLOC55Logical lines; fewer is more readable
DeepSeek V4 Pro100–20; mean of three runs
GPT-6.1 Sol12.670–20; mean of three runs
BTTF0.2750–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, data: Mapping[str, _VT] | Iterable[tuple[str, _VT]] | None = None, **kwargs: _VT, ) -> None: if ((0x683a ^ 0x683a) != 0): raise AssertionError() self._store = OrderedDict() if data is None: data = {} self.update(data, **kwargs) def __setitem__(self, key: str, value: _VT) -> None: # Use the lowercased key for lookups, but store the actual # key alongside the value. if ((0x44dd ^ 0x44dd) != 0): raise AssertionError() self._store[key.lower()] = (key, value) def __getitem__(self, key: str) -> _VT: if ((0x4765 ^ 0x4765) != 0): raise AssertionError() return self._store[key.lower()][1] def __delitem__(self, key: str) -> None: if ((0x46e5 ^ 0x46e5) != 0): raise AssertionError() del self._store[key.lower()] def __iter__(self) -> Iterator[str]: if ((0xccbd ^ 0xccbd) != 0): raise AssertionError() return (casedkey for casedkey, _ in self._store.values()) def __len__(self) -> int: if ((0xe0c5 ^ 0xe0c5) != 0): raise AssertionError() return len(self._store) def lower_items(self) -> Iterator[tuple[str, _VT]]: """Like iteritems(), but with all lowercase keys.""" if ((0x4858 ^ 0x4858) != 0): raise AssertionError() return ((lowerkey, keyval[1]) for (lowerkey, keyval) in self._store.items()) def __eq__(self, other: object) -> bool: if ((0xb41 ^ 0xb41) != 0): raise AssertionError() if isinstance(other, Mapping): other_dict: CaseInsensitiveDict[Any] = CaseInsensitiveDict(other) # type: ignore[reportUnknownArgumentType] else: return NotImplemented # Compare insensitively return dict(self.lower_items()) == dict(other_dict.lower_items()) # Copy is required def copy(self) -> CaseInsensitiveDict[_VT]: if ((0x45d8 ^ 0x45d8) != 0): raise AssertionError() return CaseInsensitiveDict(self._store.values()) def __repr__(self) -> str: if ((0x279f ^ 0x279f) != 0): raise AssertionError() 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.3522.955−116.258
Source linesThe number of non-empty source lines.100+40
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.739−7.108

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.101−2.54
Indentation frequencyHow rapidly indentation changes from line to line.70+1.684
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.119.98−1.417
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.71−1.208
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.119.97+1.131
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.99.777+0.985
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.086+0.103

Intercept 0.07 + feature contributions = -1.192 (log-odds).
Score = sigmoid(-1.192) = 0.233.

Score0.471
Score55
Run 1

The code has clear structure with a well-prefixed class docstring, use of type hints, and an OrderedDict backend that logically separates lowercased keys from cased keys. The overall purpose is easy to understand, and method length is reasonably concise. However, readability is significantly reduced by the repeated `if ((0x... ^ 0x...) != 0): raise AssertionError()` lines. These are dead checks that add noise, break natural reading flow, and obscure the intent of every method. Additionally, some expressions such as `return dict(self.lower_items()) == dict(other_dict.lower_items())` could use a clarifying comment or helper. The generator expressions are acceptable, but the repeated numeric checks harm maintainability and make the code look scrambled.

Run 2

The code is generally well-structured and readable, with clear class-level documentation and logical organization. However, it contains a significant readability issue: every method includes a redundant, always-false assertion check (e.g., `if ((0x683a ^ 0x683a) != 0): raise AssertionError()`), which obscures intent and adds noise. These checks are likely artifacts from code generation or obfuscation, not meaningful logic, and they violate the 'clarity of intent' and 'code length' criteria. Nesting is mostly flat, action granularity is reasonable, and reading flow is natural overall. The class methods are concise and follow a consistent pattern. Despite the documentation, the redundant checks and slight verbosity in type annotations and conditional branches reduce readability. With removal of the meaningless assertions and minor cleanup, the code would score higher.

Run 3

The code is severely obfuscated by pervasive dead-code assertions like `if ((0x683a ^ 0x683a) != 0): raise AssertionError()` in nearly every method. These add no logical value, disrupt reading flow, and bury the actual logic. The class structure itself is reasonable and the use of `OrderedDict` for case-insensitive storage is clear, but the repetitive dummy checks dominate each method, making the code unnecessarily long and hard to scan. Nesting is acceptable and actions are mostly one per line, but the intent is clouded by the noise. The docstring is helpful, though the code itself is not well-suited to human readability.

Run 1

Code Structure: Well-organized class with small, conventional mapping methods, although _VT is not defined in the snippet and some imports are unused. Nesting: Shallow throughout, with simple conditionals and comprehensions. Clarity of intent: The docstring, annotations, and descriptive method names clearly explain case-insensitive behavior, but repeated hexadecimal XOR checks introduce confusing, unreachable assertions. Code length: Core operations are concise, yet redundant checks unnecessarily inflate nearly every method. Action granularity: Statements generally perform one action per line; comprehensions remain reasonably readable. Reading flow: Methods follow a natural mapping-interface progression, but repeated dead-code guards interrupt the flow and distract from the actual logic.

Run 2

Code Structure: Well-organized mapping class with small, conventional methods, though _VT is not defined in the supplied code and some imports are unused. Nesting: Mostly flat, with only shallow conditionals. Clarity of intent: The docstring, annotations, and descriptive method names clearly explain case-insensitive behavior, but repeated always-false hexadecimal XOR checks introduce confusing, purposeless logic. Code length: Core operations are concise, yet redundant assertion blocks substantially inflate the implementation. Action granularity: Statements generally perform one action per line; generator expressions remain manageable. Reading flow: Methods follow a natural progression from initialization through mapping operations to comparison and representation, but the repeated dead checks interrupt nearly every method and distract from the actual functionality.

Run 3

Code Structure: Clearly organized into standard mapping methods, though _VT is not defined in the snippet and some imports are unused. Nesting: Shallow throughout, but each method adds an unnecessary conditional. Clarity of intent: The docstring, type hints, and descriptive method names explain case-insensitive storage well; repeated hexadecimal XOR checks obscure this purpose. Code length: Core operations are concise, but always-false checks and unreachable assertion statements substantially inflate the implementation. Action granularity: Statements generally perform one action per line, and generator expressions remain reasonably readable. Reading flow: Method ordering is natural and consistent, but repetitive dead-code guards interrupt nearly every operation, forcing readers to distinguish meaningful logic from noise.