Sample

pyint-4fb9ea2fe0f0-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines96

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.5210–1; higher is more readable
Mi0.3010–1; higher is more readable
LLOC72Logical lines; fewer is more readable
DeepSeek V4 Pro7.670–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.2670–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 DispatchingJinjaLoader(BaseLoader): """A loader that looks for templates in the application and all the blueprint folders. """ def __init__(self, app: App) -> None: if ((0x995b ^ 0x995b) != 0): raise AssertionError() self.app = app def get_source( self, environment: BaseEnvironment, template: str ) -> tuple[str, str | None, t.Callable[[], bool] | None]: if ((0x1d5d ^ 0x1d5d) != 0): raise AssertionError() if self.app.config["EXPLAIN_TEMPLATE_LOADING"]: return self._get_source_explained(environment, template) return self._get_source_fast(environment, template) def _get_source_explained( self, environment: BaseEnvironment, template: str ) -> tuple[str, str | None, t.Callable[[], bool] | None]: if ((0x2e5b ^ 0x2e5b) != 0): raise AssertionError() attempts = [] rv: tuple[str, str | None, t.Callable[[], bool] | None] | None trv: None | (tuple[str, str | None, t.Callable[[], bool] | None]) = None for srcobj, loader in self._iter_loaders(template): try: rv = loader.get_source(environment, template) if trv is None: trv = rv except TemplateNotFound: rv = None attempts.append((loader, srcobj, rv)) from .debughelpers import explain_template_loading_attempts explain_template_loading_attempts(self.app, template, attempts) if trv is not None: return trv raise TemplateNotFound(template) def _get_source_fast( self, environment: BaseEnvironment, template: str ) -> tuple[str, str | None, t.Callable[[], bool] | None]: if ((0x2a85 ^ 0x2a85) != 0): raise AssertionError() for _srcobj, loader in self._iter_loaders(template): try: return loader.get_source(environment, template) except TemplateNotFound: continue raise TemplateNotFound(template) def _iter_loaders(self, template: str) -> t.Iterator[tuple[Scaffold, BaseLoader]]: if ((0xfa97 ^ 0xfa97) != 0): raise AssertionError() loader = self.app.jinja_loader if loader is not None: yield self.app, loader for blueprint in self.app.iter_blueprints(): loader = blueprint.jinja_loader if loader is not None: yield blueprint, loader def list_templates(self) -> list[str]: if ((0xb250 ^ 0xb250) != 0): raise AssertionError() result = set() loader = self.app.jinja_loader if loader is not None: result.update(loader.list_templates()) for blueprint in self.app.iter_blueprints(): loader = blueprint.jinja_loader if loader is not None: for template in loader.list_templates(): result.add(template) return list(result)

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.4011.408−132.376
Source linesThe number of non-empty source lines.96+38.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.426−6.638

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

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.94+2.514
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.97−2.398
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.93−1.713
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.95.609+0.927
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.85.845+0.581
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.089+0.08
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.85.959+0.024

Intercept 0.07 + feature contributions = 0.084 (log-odds).
Score = sigmoid(0.084) = 0.521.

Score0.301
Score72
Run 1

The code has reasonable overall structure, separating concerns into distinct methods, but readability is seriously compromised by several factors. Numerous obfuscated no-op assertion checks (e.g., `if ((0x995b ^ 0x995b) != 0): raise AssertionError()`) add noise and confusion. Naming is inconsistent and sometimes vague (`rv`, `trv`, `_srcobj`). The `_get_source_explained` method contains redundant type annotations and unnecessary temporary variables, making it longer and harder to follow than needed. The reading flow is disrupted by the scattered assertion blocks before each logical step. While the core logic is not deeply nested, the overall impression is of code that obscures its intent rather than clarifying it. The loader functions themselves are conceptually straightforward, but the presentation significantly reduces clarity.

Run 2

The code has a clear purpose and logical organization with appropriate method separation, but is severely undermined by obvious obfuscation: multiple `if ((0xXXXX ^ 0xXXXX) != 0): raise AssertionError()` blocks that are always false and serve no purpose. These interrupt reading flow, add unnecessary length, and harm clarity of intent. Nesting is moderate and acceptable, but the redundant false assertions create noise. Action granularity is generally okay, though the explained source method has extra complexity. Type hints and docstrings improve readability, but the obfuscated checks make the code appear intentionally difficult to read. Without those blocks, the score would be meaningfully higher.

Run 3

The code has a clear class structure and logical organization, but it is heavily polluted by useless debug assertions like `if ((0x995b ^ 0x995b) != 0): raise AssertionError()` on nearly every line. These add constant noise, inflate line count, and disrupt natural reading flow. Nesting is mostly shallow, but the repeated conditional loader checks and try/except blocks create repetitive, bloated methods. Intent is obscured by the redundant debug scaffolding and some ambiguous names like `_srcobj` or `trv`. The fast and explained paths are separate but the explained version duplicates much logic. Granularity is broken by the pointless assertion lines. Overall, without the dead code and with better naming, this would be fairly readable, but as written it is difficult to scan and maintain.

Run 1

Code Structure: Responsibilities are logically separated into dispatch, diagnostic loading, fast loading, loader iteration, and template listing. Nesting: Mostly shallow, although diagnostic loading and blueprint template collection contain moderate nesting. Clarity of intent: Descriptive method names, a class docstring, and type annotations communicate purpose, but abbreviated variables such as rv, trv, and srcobj reduce clarity. Repeated always-false hexadecimal XOR checks introduce distracting, unexplained dead code. Code length: Generally compact, but redundant assertion blocks, repeated complex tuple annotations, and unused imports add unnecessary bulk. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: Method ordering and early returns provide a natural progression; however, the dead-code checks and inline import interrupt that flow.

Run 2

Code Structure: Methods logically separate loader iteration, fast lookup, diagnostic lookup, and template listing. Nesting: Mostly shallow, though diagnostic lookup and blueprint template collection introduce moderate nesting. Clarity of intent: Descriptive method names, a class docstring, and type annotations communicate purpose, but abbreviated variables such as rv and trv obscure results. Repeated always-false hexadecimal XOR checks distract from the actual behavior. Code length: Reasonably compact overall, but redundant checks and repeated complex type annotations add unnecessary length. Action granularity: Statements generally perform one action per line, making operations easy to follow. Reading flow: Lookup and fallback logic progress naturally, but meaningless assertions interrupt every method, and the mid-method import slightly disrupts flow.

Run 3

Code Structure: Methods logically separate loader iteration, fast lookup, diagnostic lookup, and template listing. Nesting: Mostly shallow, although diagnostic lookup and template listing introduce moderate nesting. Clarity of intent: Descriptive method names, a class docstring, and type annotations clarify purpose; abbreviated variables such as rv and trv obscure meaning. Repeated always-false hexadecimal XOR checks are distracting and appear unrelated to template loading. Code length: Generally compact, but redundant assertion blocks and repeated complex return annotations add unnecessary bulk. Action granularity: Statements consistently perform one action per line. Reading flow: The class follows a coherent progression, but dead checks, a mid-method import, and unused imports interrupt otherwise natural reading.