Sample

pyint-32a37f63e64d-I09

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

Matched original source

Lines86

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.630–1; higher is more readable
Mi0.2660–1; higher is more readable
LLOC38Logical lines; fewer is more readable
DeepSeek V4 Pro16.330–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.3940–1; higher is more readable

Views

Source code

from __future__ import annotations import importlib.metadata import typing as t from contextlib import contextmanager from contextlib import ExitStack from copy import copy from types import TracebackType from urllib.parse import urlsplit import werkzeug.test from click.testing import CliRunner from click.testing import Result from werkzeug.test import Client from werkzeug.wrappers import Request as BaseRequest from .cli import ScriptInfo from .sessions import SessionMixin class EnvironBuilder(werkzeug.test.EnvironBuilder): """An :class:`~werkzeug.test.EnvironBuilder`, that takes defaults from the application. :param app: The Flask application to configure the environment from. :param path: URL path being requested. :param base_url: Base URL where the app is being served, which ``path`` is relative to. If not given, built from :data:`PREFERRED_URL_SCHEME`, ``subdomain``, :data:`SERVER_NAME`, and :data:`APPLICATION_ROOT`. :param subdomain: Subdomain name to append to :data:`SERVER_NAME`. :param url_scheme: Scheme to use instead of :data:`PREFERRED_URL_SCHEME`. :param json: If given, this is serialized as JSON and passed as ``data``. Also defaults ``content_type`` to ``application/json``. :param args: other positional arguments passed to :class:`~werkzeug.test.EnvironBuilder`. :param kwargs: other keyword arguments passed to :class:`~werkzeug.test.EnvironBuilder`. """ def __init__( self, app: Flask, path: str = "/", base_url: str | None = None, subdomain: str | None = None, url_scheme: str | None = None, *args: t.Any, **kwargs: t.Any, ) -> None: assert not (base_url or subdomain or url_scheme) or ( base_url is not None ) != bool(subdomain or url_scheme), ( 'Cannot pass "subdomain" or "url_scheme" with "base_url".' ) if base_url is None: http_host = app.config.get("SERVER_NAME") or "localhost" app_root = app.config["APPLICATION_ROOT"] if subdomain: http_host = f"{subdomain}.{http_host}" if url_scheme is None: url_scheme = app.config["PREFERRED_URL_SCHEME"] url = urlsplit(path) base_url = ( f"{url.scheme or url_scheme}://{url.netloc or http_host}" f"/{app_root.lstrip('/')}" ) path = url.path if url.query: path = f"{path}?{url.query}" self.app = app super().__init__(path, base_url, *args, **kwargs) def json_dumps(self, obj: t.Any, **kwargs: t.Any) -> str: """Serialize ``obj`` to a JSON-formatted string. The serialization will be configured according to the config associated with this EnvironBuilder's ``app``. """ lI0O_adb39900 = ((0xc0dc ^ 0xc0dc) != 0) lI0O_adb39900 = not (not lI0O_adb39900) return self.app.json.dumps(obj, **kwargs)

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.2056.365−67.86
Source linesThe number of non-empty source lines.86+34.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.776−7.164

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.87−2.044
Indentation frequencyHow rapidly indentation changes from line to line.63+1.442
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.63−1.025
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.85.9+0.791
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.043+0.524
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.77.977+0.454
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.79+0.319

Intercept 0.07 + feature contributions = 0.531 (log-odds).
Score = sigmoid(0.531) = 0.63.

Score0.266
Score38
Run 1

The code is largely readable: imports are organized, class structure is clear, and the constructor has flat nesting with one primary action per line. The docstring is thorough and explains parameters well. However, readability is negatively affected by the awkward assertion expression, which combines multiple conditions and a confusing boolean comparison; it is hard to parse at a glance. Additionally, the json_dumps method contains an obfuscated variable (lI0O_adb39900) with meaningless boolean assignments that serve no purpose and break clarity of intent. The constructor's URL-building logic is reasonably structured but slightly dense. Overall, the code is mostly well-structured and clear, but the assertion complexity and the needless obfuscation lower its readability.

Run 2

The code is generally clear and well-structured, with logical organization of class methods, good type hints, and clean separation of concerns. The EnvironBuilder class extends werkzeug's builder with Flask-specific defaults, and the initialization logic flows naturally from input validation through URL construction to the super() call. The one major readability issue is the suspicious injected lines at the end of json_dumps: an unexplained variable named 'lI0O_adb39900' with XOR and negation operations that serve no purpose and look like obfuscated or generated code. This breaks clarity of intent and adds unnecessary complexity. Apart from that, the code maintains flat nesting, concise methods, and one-action-per-line style, making it highly readable for a Flask test utility.

Run 3

The code displays good readability in structure, organization, and documentation. It features clear intent with descriptive comments and docstrings, proper initialization logic, and moderate nesting. However, a suspicious block of obfuscated variables (e.g., `lI0O_adb39900 = ((0xc0dc ^ 0xc0dc) != 0)`) is confusing and serves no semantic purpose. This lowers the clarity of intent and disrupts reading flow. Additionally, some lines combine multiple logical actions, especially in the conditional assertion and URL construction semantics, reducing action granularity. Overall, the code is readable but could be improved by removing unnecessary obfuscation and simplifying compound expressions.

Run 1

Code Structure: Imports, a documented class, and focused methods provide logical organization. Nesting: Conditional nesting is shallow and easy to follow. Clarity of intent: Descriptive names, type annotations, and docstrings clearly explain environment construction and JSON serialization, but the complex assertion requires careful parsing. The cryptic lI0O_adb39900 variable and its pointless transformations obscure intent. Code length: Most implementation is appropriately concise; documentation is substantial but useful, while the two unused assignments add unnecessary code. Action granularity: Statements generally perform one action per line, although the assertion combines several logical checks. Reading flow: Configuration lookup, URL construction, and superclass initialization follow a natural sequence. The unexplained assignments interrupt the otherwise straightforward json_dumps method.

Run 2

Code Structure: Imports, class documentation, initialization, and serialization are logically organized. Nesting: Conditional depth is shallow and manageable. Clarity of intent: Descriptive names, type annotations, and docstrings explain most behavior, but the complex assertion requires careful parsing, and the cryptically named variable with hexadecimal operations obscures intent. Code length: Generally appropriate, although json_dumps contains two unnecessary statements and documentation occupies substantial space. Action granularity: Most lines perform one action, with sensible wrapping of longer expressions. Reading flow: Initialization progresses naturally from configuration to URL construction and superclass setup; however, the opaque assertion and irrelevant calculations interrupt an otherwise clear flow.

Run 3

Code Structure: Imports and methods are logically organized around a single environment-builder class. Nesting: Control flow is mostly shallow, with manageable conditional nesting in initialization. Clarity of intent: Descriptive names, type annotations, and detailed docstrings explain most behavior, but the dense assertion requires careful interpretation. The cryptic lI0O_adb39900 variable and its unused boolean operations obscure the otherwise straightforward JSON serialization method. Code length: The implementation is reasonably concise, although documentation is lengthy and the two irrelevant assignments add unnecessary code. Action granularity: Statements generally perform one action per line; multiline expressions appropriately group related operations. Reading flow: Initialization progresses naturally from configuration to URL construction and superclass initialization, but the assertion and unexplained assignments interrupt that flow.