Sample

pyint-d946caec3454-I05

Rewrite eligible decimal integer literals in hexadecimal notation

Matched original source

Lines46

Scores

MethodScoreScale
Posnett0.8820–1; higher is more readable
Dorn0.820–1; higher is more readable
Mi0.5040–1; higher is more readable
LLOC19Logical lines; fewer is more readable
DeepSeek V4 Pro18.330–20; mean of three runs
GPT-6.1 Sol18.330–20; mean of three runs
BTTF0.7270–1; higher is more readable

Views

Source code

from __future__ import annotations import typing as t from werkzeug.exceptions import BadRequest from werkzeug.exceptions import HTTPException from werkzeug.wrappers import Request as RequestBase from werkzeug.wrappers import Response as ResponseBase from . import json from .globals import current_app from .helpers import _split_blueprint_path class Response(ResponseBase): """The response object that is used by default in Flask. Works like the response object from Werkzeug but is set to have an HTML mimetype by default. Quite often you don't have to create this object yourself because :meth:`~flask.Flask.make_response` will take care of that for you. If you want to replace the response object used you can subclass this and set :attr:`~flask.Flask.response_class` to your subclass. .. versionchanged:: 1.0 JSON support is added to the response, like the request. This is useful when testing to get the test client response data as JSON. .. versionchanged:: 1.0 Added :attr:`max_cookie_size`. """ default_mimetype: str | None = "text/html" json_module = json autocorrect_location_header = False @property def max_cookie_size(self) -> int: # type: ignore """Read-only view of the :data:`MAX_COOKIE_SIZE` config key. See :attr:`~werkzeug.wrappers.Response.max_cookie_size` in Werkzeug's docs. """ if current_app: return current_app.config["MAX_COOKIE_SIZE"] # type: ignore[no-any-return] # return Werkzeug's default when not in an app context return super().max_cookie_size

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Source linesThe number of non-empty source lines.46+18.4
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.550.225−18.157
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.734−7.101

Intercept 8.87 + feature contributions = 2.011 (log-odds).
Score = sigmoid(2.011) = 0.882.

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.017+0.774
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.47−0.628
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.86.83+0.597
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.45.886+0.232
Indentation frequencyHow rapidly indentation changes from line to line.24+0.093
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.87−0.02

Intercept 0.07 + feature contributions = 1.515 (log-odds).
Score = sigmoid(1.515) = 0.82.

Score0.504
Score19
Run 1

The code is highly readable, with clear and logical structure. It imports modules explicitly, defines a response class with a single-focused purpose, and keeps nesting flat. The docstring clearly communicates the class's role and version changes. The `max_cookie_size` property is concise, with a natural reading flow: it first checks the app context, then falls back to the parent class. Variable and method names are descriptive, and type hints are used effectively. The code avoids unnecessary complexity and multiple actions per line, making it easy to follow and maintain.

Run 2

The code is highly readable. The class structure is logical, with a clear docstring explaining purpose and changes. Nesting is minimal; the only conditional is flat and returns early. Intent is explicit through descriptive names and type hints. The code is concise without sacrificing clarity. Each line performs one logical action, and the reading flow is natural, from imports to class definition to property. The use of comments and version change notes enhances maintainability. Minor deductions for slightly verbose docstring and repeated version notes, but overall exemplary.

Run 3

The code is highly readable, demonstrating clear structure and intent. The class definition is logical, with a well-organized docstring explaining purpose and version changes, followed by clearly named class attributes. Nesting is minimal, with only a simple if-else in the property method. The action granularity is good—each line performs a coherent action, such as returning the config value or calling the superclass. Imports are cleanly organized and type hints improve clarity. The only minor readability drawback is the inline type-ignore comments, which slightly interrupt the reading flow and add visual noise, but they are commonly used in compatibility-sensitive code. Overall, the code is concise, purposeful, and easy to follow.

Run 1

Code Structure: Imports, class configuration, and the property are logically organized. Nesting: Only one shallow conditional, with an early return keeping the implementation flat. Clarity of intent: Descriptive names, type annotations, and documentation clearly explain the response defaults and configuration fallback. Code length: Executable code is concise; the extensive class docstring and version notes slightly interrupt quick scanning but provide useful context. Action granularity: Each statement performs one action, with no compressed or compound lines. Reading flow: The code progresses naturally from dependencies to defaults to behavior, and the fallback comment clarifies the final return. Minor limitations include minimal spacing between imports and the class definition, plus type-ignore annotations that introduce some visual noise.

Run 2

Code Structure: Imports, class documentation, default attributes, and the property are logically organized, though several imports appear unused in this snippet. Nesting: Minimal nesting and an early return keep the property easy to follow. Clarity of intent: Descriptive names, type annotations, docstrings, and the fallback comment clearly explain the response defaults and configuration lookup. Code length: Implementation is concise; the lengthy documentation and version history slightly outweigh the small amount of executable code. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: The progression from class purpose to defaults to conditional configuration access is natural. Minor formatting issues, including limited separation around imports and the class declaration, slightly reduce polish.

Run 3

Code Structure: The Response subclass logically groups defaults and a configuration-backed property, although several imports are unused in this snippet. Nesting: A single conditional and early return keep the implementation flat. Clarity of intent: Descriptive names, type annotations, docstrings, and the fallback comment clearly explain behavior; framework context is needed to understand current_app. Code length: Executable code is concise, though the lengthy class docstring and version-history notes outweigh the small implementation. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: Imports, class documentation, defaults, and property implementation follow a natural order; additional spacing between import groups and the class would improve visual organization.