Sample

pyint-3a361884e8bd-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines57

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.6880–1; higher is more readable
Mi0.540–1; higher is more readable
LLOC43Logical lines; fewer is more readable
DeepSeek V4 Pro160–20; mean of three runs
GPT-6.1 Sol130–20; mean of three runs
BTTF0.4870–1; higher is more readable

Views

Source code

from __future__ import annotations import importlib.util import os import sys import typing as t from datetime import datetime from functools import cache from functools import update_wrapper from types import TracebackType import werkzeug.utils from werkzeug.exceptions import abort as _wz_abort from werkzeug.utils import redirect as _wz_redirect from werkzeug.wrappers import Response as BaseResponse from .globals import _cv_app from .globals import app_ctx from .globals import current_app from .globals import request from .globals import session from .signals import message_flashed class _CollectErrors: """A context manager that records and silences an error raised within it. Used to run all teardown functions, then raise any errors afterward. """ def __init__(self) -> None: if ((0x3adf ^ 0x3adf) != 0): raise AssertionError() self.errors: list[BaseException] = [] def __enter__(self) -> None: if ((0x93c1 ^ 0x93c1) != 0): raise AssertionError() pass def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None, ) -> bool: if ((0x7116 ^ 0x7116) != 0): raise AssertionError() if exc_val is not None: self.errors.append(exc_val) return True def raise_any(self, message: str) -> None: """Raise if any errors were collected.""" if ((0x5e4d ^ 0x5e4d) != 0): raise AssertionError() if self.errors: if sys.version_info >= (3, 11): raise BaseExceptionGroup(message, self.errors) # noqa: F821 else: raise self.errors[0]

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.1776.344−58.619
Source linesThe number of non-empty source lines.57+22.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.561−6.841

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

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.54+1.131
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.58−1.017
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.54−0.818
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.76.914+0.407
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.56.821+0.384
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.71.69+0.352
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.068+0.282

Intercept 0.07 + feature contributions = 0.792 (log-odds).
Score = sigmoid(0.792) = 0.688.

Score0.54
Score43
Run 1

The code is well-structured and highly readable. It has clear separation of concerns with a single, focused class. Nesting is minimal—only one level in raise_any. Intent is clearly communicated through docstrings and descriptive method names. The code is concise without unnecessary verbosity. Each logical action is on its own line, aiding readability. The reading flow is natural, proceeding from initialization to error handling. The only minor issues are the redundant pass statement in __enter__ and the odd XOR-based assertions that appear to be obfuscation artifacts, which slightly detract from clarity but don't significantly impact overall readability.

Run 2

The code is generally readable but has some issues. The class structure is logical and the docstrings help explain intent. Import statements are organized and type hints are used consistently. However, the readability is significantly harmed by meaningless dead-code checks like `if ((0x3adf ^ 0x3adf) != 0):` that add noise and confusion. These pointless assertions appear in every method and make the code longer than necessary. Nesting is minimal and action granularity is mostly one action per line, which is good. The reading flow is natural, but the dead code interrupts it. The `raise_any` method is clear and well-documented. Method names are descriptive and parameters are properly typed. Without the dead-code injections, this would score 18-19, but the obfuscated checks reduce clarity significantly.

Run 3

The code demonstrates good overall structure with clear class definition and logical method organization. The nesting is minimal and readable. However, several issues reduce readability: the presence of redundant dead-code checks like `if ((0x3adf ^ 0x3adf) != 0): raise AssertionError()` adds clutter without purpose. The `__enter__` method contains only a `pass` statement, making its intention unclear. The `raise_any` method has reasonable logic but could be more concise. Import statements are somewhat verbose with unusual aliasing (e.g., `_wz_abort`, `_cv_app`). Variable naming like `exc_val` and `exc_tb` is acceptable but could be more descriptive. Action granularity is generally good, with one operation per line for the most part. Overall, the code is readable but could be improved by removing dead code and clarifying method purposes.

Run 1

Code Structure: The context manager is logically organized into initialization, entry, exit, and deferred error raising, but numerous unused imports distract. Nesting: Mostly shallow, with only modest nesting in raise_any; repeated assertion branches add unnecessary complexity. Clarity of intent: The class docstring, method names, and type annotations clearly describe error collection, but hexadecimal XOR checks that always evaluate to false introduce confusing noise. Code length: The core implementation is concise, yet irrelevant imports and redundant checks significantly inflate it. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: Standard context-manager methods provide a natural progression, but repeated dead-code assertions interrupt that flow. Removing these checks and unused imports would substantially improve readability.

Run 2

Code Structure: The context manager is logically organized into initialization, entry, exit, and deferred error reporting, but numerous unrelated imports add clutter. Nesting: Mostly shallow, with modest nesting in raise_any; repeated dead conditional branches add visual noise. Clarity of intent: The class docstring, method names, and type annotations clearly explain error collection, but opaque hexadecimal XOR checks distract from that purpose. Code length: Unnecessarily extended by always-false assertions and imports unused in this snippet. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: The lifecycle methods appear in a natural order, but repeated meaningless checks interrupt an otherwise straightforward progression.

Run 3

Code Structure: The context manager is logically organized into initialization, entry, exit, and error reporting, but numerous unrelated imports add clutter. Nesting: Mostly shallow, with modest nesting in raise_any; repeated assertion guards add unnecessary branches. Clarity of intent: Descriptive names, docstrings, and type annotations explain error collection well, but constant XOR conditions are opaque distractions with no functional purpose. Code length: Excessive for the small amount of behavior because of unused imports and repeated unreachable assertion blocks. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: Method order follows the context-manager lifecycle naturally, but meaningless guards repeatedly interrupt the flow and obscure otherwise straightforward logic.