Sample

pyint-d0925dc0f7a7-I10

Deterministically remove some optional blank lines and bracketed line breaks

Matched original source

Lines53

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7430–1; higher is more readable
Mi0.0890–1; higher is more readable
LLOC36Logical lines; fewer is more readable
DeepSeek V4 Pro16.670–20; mean of three runs
GPT-6.1 Sol16.670–20; mean of three runs
BTTF0.7180–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``. """ wrap_for_ctx = kwargs.pop("with_appcontext", True) def decorator(f: t.Callable[..., t.Any]) -> click.Command: 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`. """ 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.1634.205−53.929
Source linesThe number of non-empty source lines.53+21.2
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.049

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.54−0.876
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.102.944+0.857
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.102.87−0.692
Indentation frequencyHow rapidly indentation changes from line to line.39+0.612
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.06+0.361
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.52.904+0.33

Intercept 0.07 + feature contributions = 1.06 (log-odds).
Score = sigmoid(1.06) = 0.743.

Score0.089
Score36
Run 1

The code is well-structured and follows clear patterns, with good type annotations and docstrings that explain intent. The AppGroup class has logical organization and minimal nesting. However, there are some readability issues: the 'group' method has inconsistent spacing in its signature (extra spaces before the closing parenthesis), the decorator pattern adds one extra layer of nesting, and the type ignore comments suggest potential type system friction. The command method could be slightly more concise, and the mix of type annotations with typing.Any reduces clarity slightly. Overall, it's readable but not perfect.

Run 2

The code is well-structured and readable. It uses clear type hints, docstrings, and proper class inheritance. The methods `command` and `group` are concise and follow a logical flow. There is minimal nesting, and each action is clearly separated. One minor readability issue is the alignment of parameters in the `group` method's signature, which could be formatted more consistently. Overall, the code is clean and maintainable.

Run 3

The code is well-structured with clear class documentation, type hints, and logical method organization. It avoids deep nesting and maintains a flat, readable flow. Each method has a single responsibility, and the use of decorators is concise yet explicit. However, minor readability drawbacks include long type annotations that add visual noise, and the `command` method's return type notation is quite verbose. Additionally, a few lines exceed typical width preferences, slightly reducing scanning ease. Overall, the code demonstrates strong intentionality, but could be marginally improved by simplifying or aliasing complex type expressions.

Run 1

1. Code Structure: The class groups two related decorator methods logically, although the many imports unused in this snippet add clutter. 2. Nesting: Shallow overall; the nested decorator and single conditional are easy to follow. 3. Clarity of intent: Descriptive method names, type annotations, and docstrings clearly explain application-context wrapping and group defaults, though with_appcontext is not defined in the snippet. 4. Code length: Implementations are concise, but imports and somewhat repetitive docstrings increase reading overhead. 5. Action granularity: Most lines perform one action; the chained superclass command invocation is slightly denser. 6. Reading flow: Behavior proceeds naturally from configuration to decoration or delegation, but inconsistent signature formatting and sparse blank lines detract from visual readability.

Run 2

Code Structure: The class cleanly separates command wrapping from group configuration, although the large import block includes many imports unused in this excerpt. Nesting: Shallow nesting, with only a decorator closure and a simple conditional, keeps complexity low. Clarity of intent: Descriptive method names, type annotations, and helpful docstrings explain the behavior; with_appcontext is referenced but not defined in the excerpt. Code length: The implementation is concise, though extensive imports and documentation outweigh the small amount of logic. Action granularity: Each statement generally performs one action, with the chained superclass command invocation slightly increasing interpretation effort. Reading flow: Execution reads naturally from configuration to decoration and return, but inconsistent signature formatting, long lines, and limited spacing around definitions reduce polish.

Run 3

Code Structure: Methods are logically grouped in a focused class, although the extensive imports distract from the small excerpt. Nesting: Shallow nesting, with only a decorator closure and one conditional, keeps complexity low. Clarity of intent: Descriptive names, type annotations, and explanatory docstrings clearly communicate the app-context wrapping and default group behavior. Code length: The implementation is concise; documentation is useful rather than excessive, though imports dominate the excerpt. Action granularity: Each statement generally performs one action, with the chained command creation and callback application slightly denser. Reading flow: The methods follow a natural sequence, but inconsistent signature formatting, limited spacing around definitions, and inline type-ignore comments introduce minor visual friction.