Sample

pyint-c91020422d65-I11

Split eligible integer literals into pairs of short-named intermediate 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 Pro16.670–20; mean of three runs
GPT-6.1 Sol17.670–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 with clear structure and intent. Imports are organized logically, grouped by source (stdlib, third-party, local modules), and each import is on its own line. The class definition is concise with a clear docstring explaining the Flask-specific behavior. The __init__ method demonstrates good action granularity—each logical step (checking for a loader, assigning a default, calling the parent constructor, storing the app reference) is on its own line, making the flow easy to follow. Nesting is minimal, with only a single conditional that is straightforward. The type hints and use of t.Any improve clarity. Variable naming is descriptive (options, app). The method is short and focused on initialization. Minor deduction could be made for the slightly dense conditional assignment on two lines, but overall the code is clean, purposeful, and easy to understand.

Run 3

The code is generally well-structured and readable. It has clear imports, a concise docstring explaining the class's purpose, and a straightforward __init__ method with flat nesting. Naming is clear, and the logic is easy to follow. Minor deductions: the BaseEnvironment.__init__ call slightly disrupts natural reading flow compared to using super(), and the type hint 'App' appears without a visible import, which could confuse readers. Overall, it is concise and maintainable.

Run 1

Code Structure: Imports followed by a single focused class and constructor provide logical organization, though several imports are unused in this snippet. Nesting: Only one shallow conditional keeps complexity low. Clarity of intent: Descriptive names and the docstring explain the environment's role, but the documented blueprint behavior is not shown, and the App annotation lacks a visible import. Code length: The implementation is concise with no unnecessary procedural code. Action granularity: Each statement performs one clear action. Reading flow: The constructor naturally progresses from selecting a default loader to initializing the base environment and storing the application; additional spacing between imports and the class would improve visual separation.

Run 2

Code Structure: Imports followed by a focused class and constructor provide clear organization, though several imports are unused in this snippet. Nesting: A single conditional keeps nesting shallow. Clarity of intent: Descriptive names, type annotations, and the docstring communicate framework integration, although blueprint behavior is not demonstrated here and App is not defined or imported in the snippet. Code length: The implementation is concise without unnecessary 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. Additional spacing between import groups and before the class would improve visual readability.

Run 3

Code Structure: Imports and a focused environment subclass are logically organized, though several imports are unused in this snippet. Nesting: Only one shallow conditional keeps the constructor easy to follow. Clarity of intent: The class name, docstring, and loader initialization communicate its purpose, although the documented blueprint behavior is not visible here and App is not imported in the snippet. Code length: The implementation is concise without unnecessary logic. Action granularity: Each statement performs one clear action. Reading flow: Initialization proceeds naturally from supplying a default loader to initializing the base environment and storing the application. Additional spacing between import groups and before the class would improve visual readability.