Sample

pyint-fad8e05a65ce-I05

Rewrite eligible decimal integer literals in hexadecimal notation

Matched original source

Lines56

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7640–1; higher is more readable
Mi0.1380–1; higher is more readable
LLOC36Logical lines; fewer is more readable
DeepSeek V4 Pro16.330–20; mean of three runs
GPT-6.1 Sol17.330–20; mean of three runs
BTTF0.7220–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.56+22.4
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.701−7.052

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.57−0.982
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.97.333+0.766
Indentation frequencyHow rapidly indentation changes from line to line.42+0.716
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.93−0.525
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.55.84+0.371
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.06+0.361

Intercept 0.07 + feature contributions = 1.174 (log-odds).
Score = sigmoid(1.174) = 0.764.

Score0.138
Score36
Run 1

The code is well-structured and readable. It uses clear class and method names, proper type hints, and concise docstrings. Nesting is minimal, with only one level inside the decorator. Action granularity is good, with one main action per line. The reading flow is natural, progressing from imports to class definition to method overrides. Minor deductions: the decorator closure adds slight indirection, and type-ignore comments add noise. The `super(AppGroup, self).command` call is explicit but slightly verbose compared to `super().command`. Overall, the code is clean, maintainable, and easy to follow for developers familiar with Click and Flask.

Run 2

The code is well-structured and readable. It logically groups functionality into the AppGroup class with clear docstrings explaining each method's purpose. Nesting is minimal, limited to one function decorator level. Intent is explicit through descriptive method and variable names (e.g., wrap_for_ctx, kwargs.setdefault). Code length is appropriate—concise yet informative. Action granularity is reasonable, with each line performing a distinct operation. Reading flow is natural, following a top-down progression from class definition to methods. Minor deductions stem from complex type annotations that can reduce scanning speed, and a slight ambiguity in the use of kwargs for click.Group overrides, which requires familiarity with click internals. Overall, the code maintains a strong balance between clarity and conciseness.

Run 3

The code is well-structured and readable. It defines a single class with two methods, each with clear docstrings explaining purpose and differences from the parent class. Nesting is minimal, limited to the decorator function within the command method. Intent is clear: this class extends click.Group to add Flask application context wrapping. Type hints are used consistently, improving clarity. Lines are reasonably concise, though some type-ignore comments add noise. Action granularity is appropriate—each line performs one logical operation. The reading flow is natural: class definition, then methods with descriptive docstrings. The only minor deductions are for the verbose type annotations and the slightly distracting type-ignore comments, which slightly interrupt flow but are necessary for static type checking.

Run 1

Code Structure: The class cleanly separates command wrapping from group configuration, although the large import block includes many imports unused in this snippet. Nesting: Shallow nesting, with only a local decorator and one conditional, keeps complexity low. Clarity of intent: Descriptive method names, type annotations, and detailed docstrings clearly explain the behavior; with_appcontext is referenced but not defined here. Code length: Methods are concise, though imports and verbose type annotations add visual overhead. Action granularity: Each statement performs a focused action, with no compressed multi-statement lines. Reading flow: Configuration, callback wrapping, and delegation follow a natural sequence. Minor distractions include inline type-ignore comments, the chained decorator invocation, and limited spacing around the import block and class declaration.

Run 2

Code Structure: The class is logically organized into two focused methods, with clear docstrings, although many imports are unused in this snippet. Nesting: Nesting is shallow; the inner decorator and single conditional are easy to follow. Clarity of intent: Descriptive names, type annotations, and documentation clearly explain application-context wrapping and the default group class. Code length: Method implementations are concise, but the extensive import list and somewhat repetitive docstrings add overhead. Action granularity: Statements generally perform one action each, though the chained superclass command invocation and callback application compress several steps into one expression. Reading flow: Consistent formatting and straightforward control flow support natural reading, with minor interruptions from long type annotations, type-ignore comments, and framework-specific decorator mechanics.

Run 3

Code Structure: The class cleanly separates command and group customization, although many imports are unused in this snippet. Nesting: Shallow nesting, with only an inner decorator and a simple conditional. Clarity of intent: Descriptive names, type annotations, and explanatory docstrings make the behavior clear; with_appcontext is not defined here, so some context is required. Code length: Methods are concise, though the import block is disproportionately long for the shown functionality. Action granularity: Most lines perform a single action; the chained superclass call and decorator application are slightly dense. Reading flow: The methods follow a natural setup-and-return pattern, but verbose annotations and inline type-ignore comments add visual clutter.