Sample

pyint-2bc85f36169b-I09

Select one of ten low-readability unrelated code templates per class

Matched original source

Lines87

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.5380–1; higher is more readable
Mi0.3350–1; higher is more readable
LLOC63Logical lines; fewer is more readable
DeepSeek V4 Pro12.670–20; mean of three runs
GPT-6.1 Sol14.670–20; mean of three runs
BTTF0.320–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: self.app = app def get_source( self, environment: BaseEnvironment, template: str ) -> tuple[str, str | None, t.Callable[[], bool] | None]: 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]: 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]: 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]]: lI0O_69bcf6a5, lI0O_ea9526d3 = 0x9057, ~0x9057 lI0O_69bcf6a5 = (lI0O_69bcf6a5 & lI0O_ea9526d3) | (lI0O_69bcf6a5 ^ lI0O_69bcf6a5) lI0O_ea9526d3 ^= lI0O_ea9526d3 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]: 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.3553.256−117.257
Source linesThe number of non-empty source lines.87+34.8
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.501−6.751

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

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.85+2.203
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.88−2.079
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.85−1.53
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.86.767+0.803
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.88.864+0.629
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.081+0.158
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.88.955−0.103

Intercept 0.07 + feature contributions = 0.151 (log-odds).
Score = sigmoid(0.151) = 0.538.

Score0.335
Score63
Run 1

Overall, the code is reasonably readable with clear structure and purpose. The class is logically organized with separate methods for explained vs fast template loading, and action granularity is good — one primary action per line. However, there is a notable issue in `_iter_loaders`: the presence of nonsensical variable names (`lI0O_69bcf6a5`, `lI0O_ea9526d3`) significantly harms readability, suggesting obfuscated or auto-generated code that adds confusion. Also, the `_get_source_explained` method is slightly convoluted with multiple optional return-type variables (`rv`, `trv`) and repeated type annotations, making it harder to follow. Nesting is moderate and mostly acceptable. The reading flow is natural until the odd variable naming disrupts comprehension. Length is concise but could benefit from cleaner helper extraction for repeated loader checks. Overall, the code is competent but marred by confusing naming in one method.

Run 2

The code is generally readable with clear class structure, descriptive method names, and good type hints. The separation of 'explained' and 'fast' loading paths is logical. However, readability is significantly impacted by the obfuscated variable names and dead code in _iter_loaders (lines lI0O_69bcf6a5, lI0O_ea9526d3 appear to be meaningless bit operations with no effect). This breaks clarity of intent and reading flow. The nested try/except blocks and tuple unpacking add moderate complexity. Action granularity is acceptable, but some lines combine multiple operations. The class serves a clear purpose but the mysterious code section makes parts feel disorganized.

Run 3

The code has clear class/method structure and reasonable type hints, but several issues hurt readability. The obfuscated variable names in _iter_loaders (e.g., lI0O_69bcf6a5) are completely opaque and serve no purpose, violating clarity of intent and reading flow. The variable naming in _get_source_explained is ambiguous (rv, trv) without explanation. Nesting is moderate but not deeply problematic. Action granularity is generally acceptable, with one main action per line. However, the unexplained distinction between 'fast' and 'explained' paths requires domain knowledge. The loader iteration has redundant repeated patterns that could be abstracted. Overall, while the skeleton is logical, the confusing names and unexplained magic variables significantly degrade readability, preventing a higher score.

Run 1

Code Structure: Methods cleanly separate loader dispatch, diagnostic loading, fast loading, and template listing, but unrelated bitwise operations disrupt the organization. Nesting: Mostly shallow; diagnostic loading and template listing introduce manageable nested blocks. Clarity of intent: Descriptive method names, a class docstring, and type annotations communicate purpose, while opaque identifiers, unexplained bitwise calculations, and abbreviations such as rv and trv reduce clarity. Code length: Generally concise, though repeated complex tuple annotations, unnecessary calculations, and the template-listing inner loop add avoidable length. Action granularity: Most lines perform one clear action; the multi-variable assignment and compound bitwise expression are exceptions. Reading flow: Method boundaries and straightforward control flow support natural reading, but obfuscated statements and the mid-method import interrupt it.

Run 2

Code Structure: Methods logically separate loader dispatch, diagnostics, fast lookup, and template listing, but unrelated bitwise operations disrupt the organization. Nesting: Mostly shallow, with modest nesting in exception handling and template collection. Clarity of intent: Descriptive method names and the class docstring explain the purpose; however, cryptic variables such as rv and trv, especially the obfuscated lI0O names, reduce clarity. Code length: Generally concise, but repeated complex type annotations and unused bitwise calculations add unnecessary bulk. Action granularity: Most lines perform one clear action, although the multi-variable assignment and compound bitwise expression are harder to parse. Reading flow: The methods follow a natural progression, but the unexplained calculations and inline import interrupt it.

Run 3

Code Structure: Methods logically separate loader dispatch, diagnostic loading, fast loading, and template listing. Nesting: Mostly shallow, though diagnostic loading and template listing contain moderately nested blocks. Clarity of intent: Descriptive method names, a class docstring, and type hints explain the main behavior, but cryptic rv/trv names and meaningless bitwise operations with obfuscated variables obscure intent. Code length: Generally concise, although repeated complex type annotations, unused imports, and unnecessary operations add clutter. Action granularity: Most lines perform one action; the initial paired assignment and compound bitwise expression are exceptions. Reading flow: The class progresses naturally from dispatch to implementation and enumeration, but the unexplained operations interrupt loader iteration, and the local diagnostic import slightly disrupts flow. Overall, the core implementation is readable despite conspicuous obfuscation and minor verbosity.