Sample

pyint-10a4c1d0d08c-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines23

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8350–1; higher is more readable
Mi0.2760–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro17.330–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.6240–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, app2: App, **opt: t.Any) -> None: if "loader" not in opt: opt["loader"] = app2.create_global_jinja_loader() BaseEnvironment.__init__(self, **opt) self.app = app2

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.597.591−19.721
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.597−6.896

Intercept 8.87 + feature contributions = -8.546 (log-odds).
Score = sigmoid(-8.546) = 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.958+0.66
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.042+0.533
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.903−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.625 (log-odds).
Score = sigmoid(1.625) = 0.835.

Score0.276
Score18
Run 1

The code is well-structured with clear imports, a docstring explaining the class's purpose, and a concise __init__ method. Nesting is minimal, with only a single conditional check. Intent is clear: this custom Environment extends Jinja2 to support Flask's blueprint template resolution. The code length is appropriate—no unnecessary verbosity. Action granularity is good, with one logical action per line (the conditional assignment, the parent constructor call, and the attribute assignment). Reading flow is natural: imports, then class definition, then method, following a logical top-to-bottom progression. Minor deductions: the parameter name 'app2' is slightly awkward (likely intentional to avoid shadowing 'app' attribute) but could confuse readers; type hints are helpful but 'App' isn't imported or referenced explicitly. Overall, highly readable and maintainable code.

Run 2

The code is highly readable. It follows a clear logical structure: imports are grouped and ordered, the class has a concise docstring explaining its purpose, and the constructor clearly overrides the parent with a specific customization. Nesting is minimal, with a single conditional block. Variable naming is descriptive, though 'app2' is slightly awkward. The loader setup is explicit and intent-revealing. Code length is minimal and focused. Each action is on its own line, enhancing clarity. Reading flow is natural: imports, docstring, logic, assignment. Overall, it is idiomatic Flask extension code that is easy to follow, with only minor naming nitpicks preventing a perfect score.

Run 3

The code is generally clean and readable. The class has a clear docstring explaining its purpose. Imports are organized with `typing` and specific Flask/Jinja2 imports. The `__init__` method is short, with a single conditional that modifies the options dict before calling the parent constructor. Naming is mostly clear (`app2`, `opt`), though `app2` is slightly awkward — likely renamed to avoid shadowing the `app` attribute. Nesting is minimal, and each action is on its own line. The one-line `if` could be slightly expanded with a newline for readability, but it's acceptable. Overall structure is logical and intent is evident.

Run 1

Code Structure: Imports and a single focused class are logically organized, though several imports are unused in this snippet. Nesting: Only one shallow conditional, making control flow easy to follow. Clarity of intent: The docstring and loader initialization communicate the purpose, but names such as app2 and opt are less descriptive, App is not visibly imported, and the blueprint behavior described is not shown directly. 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 default loader to initializing the base environment and storing the application; additional spacing between import groups and before the class would improve scanning.

Run 2

Code Structure: Clearly organized imports followed by a focused class and initializer, although several imports appear unused in this snippet. Nesting: Minimal, with only one straightforward conditional. Clarity of intent: The superclass extension and default loader setup are easy to understand, but names such as app2 and opt are less descriptive than app and options. The docstring describes blueprint behavior not directly demonstrated here, and App is not imported in the snippet. Code length: Compact without unnecessary implementation detail. Action granularity: Each statement performs a single clear action. Reading flow: Initialization proceeds naturally from selecting a default loader to initializing the superclass and storing the application reference; additional spacing between imports and the class would improve visual separation.

Run 3

Code Structure: Imports and a focused class are logically organized, though several imports are unused in this snippet. Nesting: A single conditional keeps the constructor shallow and easy to follow. Clarity of intent: The default-loader setup and application storage are clear, but names such as app2 and opt are less descriptive, App is not imported in the snippet, and the docstring describes behavior not directly visible here. Code length: The implementation is concise, although unused imports add clutter. Action granularity: Each statement performs one action, with no compressed multi-action lines. Reading flow: The constructor follows a natural sequence: choose a default loader, initialize the base environment, and store the application. Minor spacing improvements between imports and the class would improve presentation.