Sample

pyint-837ac0d8fb94-I06

Invert eligible conditions and exchange their branches

Matched original source

Lines25

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8420–1; higher is more readable
Mi0.2820–1; higher is more readable
LLOC19Logical lines; fewer is more readable
DeepSeek V4 Pro120–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.6420–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 not ("loader" not in options): pass else: 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.634.462−20.937
Source linesThe number of non-empty source lines.25+10
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.543−6.814

Intercept 8.87 + feature contributions = -8.882 (log-odds).
Score = sigmoid(-8.882) = 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.923+0.661
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.043+0.522
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.26+0.116
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.24.972−0.061
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.46.462−0.055
Indentation frequencyHow rapidly indentation changes from line to line.22+0.024

Intercept 0.07 + feature contributions = 1.676 (log-odds).
Score = sigmoid(1.676) = 0.842.

Score0.282
Score19
Run 1

The code is generally readable but has a confusing conditional in __init__: 'if not ("loader" not in options): pass else: ...' is unnecessarily convoluted and could be written as 'if "loader" not in options: options["loader"] = ...'. This harms clarity of intent and reading flow. The class docstring is helpful, imports are clearly organized, and the overall structure is straightforward with minimal nesting. However, the conditional issue and redundant pass statement add unnecessary complexity. Action granularity is mostly one action per line, and the code is concise, but the awkward conditional prevents a higher score.

Run 2

The code is generally readable but has some confusing sections. The class docstring is clear and helpful. However, the conditional logic in __init__ is unnecessarily convoluted: 'if not ("loader" not in options): pass else: ...' could be simplified to 'if "loader" not in options: options["loader"] = ...'. The action granularity is reasonable, with one main action per line, and the reading flow is mostly natural. The type hints improve clarity. The main deduction comes from the needlessly complex conditional structure that obscures intent, making readers work harder than necessary to understand a simple check-and-set operation.

Run 3

The code has a clear class purpose and good type hints, but readability suffers from a convoluted conditional in __init__. The 'if not ("loader" not in options): pass else:...' construct is logically inverted and unnecessarily verbose, obscuring intent. A simpler 'if "loader" not in options:' would improve clarity. Multiple imports from the same module are stacked on separate lines, adding visual noise without benefit. The class docstring is helpful, but the method body's odd branching pattern disrupts natural reading flow. Overall structure is logical, nesting is shallow, and action granularity is mostly fine, but the conditional logic and import style lower the score.

Run 1

Code Structure: Imports and the class are logically organized, though several imports are unused in this snippet. Nesting: Shallow, but the empty if branch and else introduce unnecessary control flow. Clarity of intent: The docstring and type annotations help, but the double-negative condition obscures the simple intent of supplying a default loader. The App annotation has no visible definition or import. Code length: Short overall, although the pass branch is redundant. Action granularity: Each statement performs one action, making individual lines easy to follow. Reading flow: Generally natural, but readers must mentally simplify the condition; using if "loader" not in options would make initialization substantially clearer.

Run 2

Code Structure: Imports and a focused Environment subclass are logically organized. Nesting: Shallow, but the empty if branch and else unnecessarily complicate a simple default-setting operation. Clarity of intent: The docstring and descriptive names help, but the double-negative condition obscures the loader check; App is not defined or imported in the snippet, and the docstring describes behavior not directly demonstrated here. Code length: Short overall, though several imports are unused in this excerpt and the pass branch is redundant. Action granularity: Each statement performs one clear action. Reading flow: Initialization follows a natural sequence, but the awkward conditional interrupts it; using if "loader" not in options would improve readability.

Run 3

Code Structure: Imports and the small Environment subclass are logically organized. Nesting: Nesting is shallow, but the empty if branch and else create unnecessary control flow. Clarity of intent: The docstring and descriptive loader call help, but the double negative in `if not ("loader" not in options)` obscures a simple default-loader check. The App annotation has no visible import, and several imports are unused in this snippet. Code length: The implementation is short, though replacing the conditional with `if "loader" not in options` would remove redundant lines. Action granularity: Each line performs a single action, making individual operations easy to identify. Reading flow: Initialization proceeds naturally from loader configuration to superclass initialization and app assignment, but the inverted condition and pass interrupt that flow.