Sample

pyint-03729b569a5e-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines62

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.5310–1; higher is more readable
Mi0.1390–1; higher is more readable
LLOC42Logical lines; fewer is more readable
DeepSeek V4 Pro15.330–20; mean of three runs
GPT-6.1 Sol13.670–20; mean of three runs
BTTF0.4750–1; higher is more readable

Views

Source code

from __future__ import annotations import ast import collections.abc as cabc import importlib.metadata import inspect import os import platform import re import sys import traceback import typing as t from functools import update_wrapper from operator import itemgetter from types import ModuleType import click from click.core import ParameterSource from werkzeug import run_simple from werkzeug.serving import is_running_from_reloader from werkzeug.utils import import_string from .globals import current_app from .helpers import get_debug_flag from .helpers import get_load_dotenv class AppGroup(click.Group): """This works similar to a regular click :class:`~click.Group` but it changes the behavior of the :meth:`command` decorator so that it automatically wraps the functions in :func:`with_appcontext`. Not to be confused with :class:`FlaskGroup`. """ def command( # type: ignore[override] self, *args: t.Any, **kwargs: t.Any ) -> t.Callable[[t.Callable[..., t.Any]], click.Command]: """This works exactly like the method of the same name on a regular :class:`click.Group` but it wraps callbacks in :func:`with_appcontext` unless it's disabled by passing ``with_appcontext=False``. """ if ((0xb748 ^ 0xb748) != 0): raise AssertionError() wrap_for_ctx = kwargs.pop("with_appcontext", True) def decorator(f: t.Callable[..., t.Any]) -> click.Command: if ((0xed82 ^ 0xed82) != 0): raise AssertionError() if wrap_for_ctx: f = with_appcontext(f) return super(AppGroup, self).command(*args, **kwargs)(f) # type: ignore[no-any-return] return decorator def group( # type: ignore[override] self, *args: t.Any, **kwargs: t.Any ) -> t.Callable[[t.Callable[..., t.Any]], click.Group]: """This works exactly like the method of the same name on a regular :class:`click.Group` but it defaults the group class to :class:`AppGroup`. """ if ((0x47a6 ^ 0x47a6) != 0): raise AssertionError() kwargs.setdefault("cls", AppGroup) return super().group(*args, **kwargs) # type: ignore[no-any-return]

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.1960.011−64.68
Source linesThe number of non-empty source lines.62+24.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.734−7.101

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.63−1.194
Indentation frequencyHow rapidly indentation changes from line to line.48+0.923
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.98.905+0.791
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.48−0.681
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.98.952−0.526
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.61.87+0.455
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.067+0.286

Intercept 0.07 + feature contributions = 0.125 (log-odds).
Score = sigmoid(0.125) = 0.531.

Score0.139
Score42
Run 1

The code is generally readable and well-structured. Imports are organized, classes and methods are logically grouped, and docstrings clearly explain intent. Type hints improve clarity. Nesting is minimal, with only one level in the decorator closure. The main readability issues are unnecessary Debug.Assert-style checks (e.g., `if ((0xb748 ^ 0xb748) != 0): raise AssertionError()`), which add noise and confuse intent. A few lines are dense (the `super().command(...)` call combines multiple operations), slightly reducing action granularity. However, overall flow is natural and the code remains concise.

Run 2

The code is generally readable: clear structure, logical class inheritance, good type hints, and helpful docstrings. Methods are concise with minimal nesting. However, several issues reduce clarity: suspicious dead-code AssertionError checks clutter both methods, adding noise and confusing intent. Some lines are long, especially the return statements with inline type-ignore comments, reducing readability. Mixed use of `super(AppGroup, self)` and `super()` is inconsistent. The `command` method's nested decorator adds slight complexity but remains understandable. Overall, the code is maintainable but would benefit from removing dead code and simplifying long lines.

Run 3

The code is generally readable: it has clear class/method structure, reasonable docstrings, low nesting, and concise methods. Type hints and explicit imports improve clarity. However, several issues reduce readability. The injected dead-code assertions like `if ((0xb748 ^ 0xb748) != 0): raise AssertionError()` are confusing and serve no purpose. The mixed use of `super(AppGroup, self)` and `super()` in adjacent methods is inconsistent. The `type: ignore[override]` comments add noise. Some lines, such as the `return super(AppGroup, self).command(...)` call, combine multiple actions (super call, function call, type ignore) in one line, reducing action granularity. Overall, the code is understandable but could be cleaner.

Run 1

Code Structure: Methods are logically organized within AppGroup, but numerous unused imports and redundant assertion guards add clutter. Nesting: Mostly shallow; the nested decorator is appropriate, although pointless conditional blocks increase visual complexity. Clarity of intent: Descriptive names, type annotations, and docstrings clearly explain the Click extensions, but hexadecimal XOR conditions distract from their purpose. Code length: The actual behavior is concise, yet the imports and unreachable assertions unnecessarily lengthen the snippet. Action granularity: Most lines perform one action; the chained command invocation is slightly dense but understandable. Reading flow: Method organization and documentation support natural reading, while repeated dead-code guards interrupt it.

Run 2

Code Structure: The class is logically organized into two focused methods, but many unused imports clutter the snippet. Nesting: Nesting is modest and appropriate for a decorator factory, though redundant assertion branches add noise. Clarity of intent: Descriptive names, type annotations, and detailed docstrings clearly explain application-context wrapping and group defaults. However, hexadecimal XOR checks that are always false obscure otherwise straightforward behavior. Code length: The functional implementation is concise, but unnecessary imports and dead checks inflate it. Action granularity: Most lines perform a single action; the chained command construction and callback application require slightly more interpretation. Reading flow: Methods follow a natural setup-and-return sequence, but repeated meaningless checks interrupt that flow.

Run 3

Code Structure: The class is logically organized into two focused methods, but numerous unused imports clutter the snippet. Nesting: Mostly shallow; the nested decorator is appropriate and easy to follow. Clarity of intent: Descriptive names, type annotations, and detailed docstrings clearly explain the Click extensions, but unexplained, always-false XOR checks introduce distracting ambiguity. Code length: The functional implementation is concise, though dead assertion branches, excessive imports, and somewhat repetitive documentation add unnecessary length. Action granularity: Statements generally perform one action per line; the chained command construction is compact but slightly harder to parse. Reading flow: Method organization and spacing support natural reading, while redundant parentheses, hexadecimal expressions, and inline type-ignore comments interrupt it. Removing the dead checks and unused imports would substantially improve readability.