Sample

pyint-ce609f6e0dcb-I12

Inline all eligible single-use intermediate local variables

Matched original source

Lines23

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8370–1; higher is more readable
Mi0.2790–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro17.330–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.6680–1; higher is more readable

Views

Source code

from __future__ import annotations import typing as t from jinja2 import BaseLoader from jinja2 import Environment as BaseEnvironment from jinja2 import Template from jinja2 import TemplateNotFound from .ctx import AppContext from .globals import app_ctx from .helpers import stream_with_context from .signals import before_render_template from .signals import template_rendered class Environment(BaseEnvironment): """Works like a regular Jinja environment but has some additional knowledge of how Flask's blueprint works so that it can prepend the name of the blueprint to referenced templates if necessary. """ def __init__(self, app: App, **options: t.Any) -> None: if "loader" not in options: options["loader"] = app.create_global_jinja_loader() BaseEnvironment.__init__(self, **options) self.app = app

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.594.341−19.613
Source linesThe number of non-empty source lines.23+9.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.582−6.872

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

Feature contributions

FeatureValueContribution
(log-odds)
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.70.917+0.661
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.041+0.539
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.24+0.187
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.22.917−0.09
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.44.417−0.088
Indentation frequencyHow rapidly indentation changes from line to line.20−0.045

Intercept 0.07 + feature contributions = 1.633 (log-odds).
Score = sigmoid(1.633) = 0.837.

Score0.279
Score18
Run 1

The code is well-structured with clear imports, a class definition, and an __init__ method that handles loader setup cleanly. Nesting is minimal; there is only one conditional at a shallow level. Intent is clear from the docstring and method logic—customizing Jinja's environment for Flask blueprints. The length is concise but complete. Action granularity is appropriate: each line performs a single clear action. Reading flow is natural, moving from imports to class definition to method logic. Minor deductions: the conditional could be slightly more explicit about its purpose, and typing could be more specific (e.g., using a protocol for app), but overall readability is high.

Run 2

The code is highly readable. It has a clear, single-purpose class with a well-documented docstring explaining its Flask-specific behavior. Imports are logically grouped and use explicit names. The __init__ method is concise, with a simple conditional and clear delegation. Nesting is minimal—only one level—and each step is a distinct action. Type hints and future annotations maintain clarity.

Run 3

The code is clean and highly readable. It uses clear imports with alphabetical ordering, type hints, and a well-documented class purpose. The `__init__` method is concise, with a single conditional ensuring a loader is provided, followed by the parent initialization and a simple attribute assignment. Nesting is minimal, and each logical action is clearly separated. The use of `t.Any` and explicit class inheritance adds clarity without unnecessary verbosity. Overall, the structure is logical, intent is obvious, and the reading flow is natural.

Run 1

Code Structure: Imports followed by a small subclass and initializer provide logical organization, though several imports are unused in this snippet. Nesting: Only one shallow conditional makes the code easy to scan. Clarity of intent: The initializer clearly supplies a default loader and stores the application, but App is not imported or defined here, and the docstring describes blueprint behavior not directly shown. Code length: The implementation is concise, with minimal boilerplate. Action granularity: Each statement performs one distinct action. Reading flow: Execution proceeds naturally from loader configuration to superclass initialization and application storage; additional blank lines between imports and the class would improve visual separation.

Run 2

Code Structure: Imports and a focused environment subclass are logically organized, though several imports are unused in this snippet. Nesting: A single conditional keeps nesting shallow. Clarity of intent: Descriptive names, type annotations, and a class docstring explain the Flask-specific extension; however, the docstring describes blueprint behavior not directly visible here, and App is not defined or imported in the snippet. Code length: The implementation is concise without redundant logic. Action granularity: Each statement performs one clear action. Reading flow: The constructor naturally progresses from supplying a default loader to initializing the base environment and storing the application.

Run 3

Code Structure: Imports and a single focused class are logically organized, although several imports are unused in this snippet. Nesting: Only one shallow conditional, making control flow easy to follow. Clarity of intent: Descriptive names, type annotations, and a docstring explain the Flask-aware environment and default loader setup; however, App is not defined or imported in the snippet, and the docstring describes behavior not directly shown. Code length: The implementation is concise without unnecessary logic. Action granularity: Each statement performs one clear action. Reading flow: Initialization proceeds naturally from selecting a loader to initializing the base environment and storing the application. Additional blank lines between import groups and before the class would improve visual separation.