Sample

pyint-85cb547422f4-I08

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

Matched original source

Lines49

Scores

MethodScoreScale
Posnett0.6470–1; higher is more readable
Dorn0.820–1; higher is more readable
Mi0.5040–1; higher is more readable
LLOC22Logical lines; fewer is more readable
DeepSeek V4 Pro160–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.5290–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. """ total_score = 240 number_of_scores = 3 average_score = total_score / number_of_scores 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)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.629.952−20.788
Source linesThe number of non-empty source lines.49+19.6
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.718−7.077

Intercept 8.87 + feature contributions = 0.604 (log-odds).
Score = sigmoid(0.604) = 0.647.

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.019+0.762
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.50−0.734
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.85.22+0.571
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.48.875+0.273
Indentation frequencyHow rapidly indentation changes from line to line.27+0.197
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.86.96−0.018

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

Score0.504
Score22
Run 1

The code is generally readable but has a few issues. The class structure is logical with clear inheritance and imports are organized. However, three unexplained variables (total_score, number_of_scores, average_score) appear before the actual logic, creating ambiguity about their purpose. The nesting is flat and the property method has clear intent, but the dead code adds unnecessary length and confusion. Action granularity is mostly good with one operation per line, though the dead code violates this principle. The reading flow is natural until encountering the unexplained variables, which breaks comprehension. The docstring is thorough and helpful. The type hints are appropriate and improve clarity. The conditional logic is straightforward. Overall, the code would be highly readable if the three dead-code lines were removed, as they introduce confusion without serving any purpose in the method's functionality.

Run 2

The code is generally well-structured and readable, with clear imports, a focused class definition, and a simple property. However, there are two unrelated lines (`total_score = 240`, `number_of_scores = 3`, `average_score = ...`) injected inside the `max_cookie_size` property that break the flow and clarity of intent, appearing to be leftover debugging code. Apart from this, the class is flat, concise, and each method contains only one logical action. The docstring and comments provide useful context without being excessive.

Run 3

The code is well-structured with clear imports, class definition, and a single property method. The nesting is minimal. The intent of the `max_cookie_size` property is clear, though the presence of unrelated lines (`total_score = 240`, `number_of_scores = 3`, `average_score = ...`) harms clarity and appears to be accidental. The code is concise, with one action per line and a natural reading flow. The score is reduced due to these stray lines and minor redundancy in import style.

Run 1

Code Structure: Imports, class attributes, and a focused property are logically organized, though unrelated score calculations weaken cohesion. Nesting: A single conditional keeps the code flat and easy to follow. Clarity of intent: Descriptive names, type annotations, and documentation explain the response class and configuration lookup; unused scoring variables introduce ambiguity. Code length: The implementation is concise, but the unused calculations and extensive historical documentation add reading overhead. Action granularity: Each statement performs one action, with no compressed multi-action lines. Reading flow: The configuration check followed by a superclass fallback reads naturally, but irrelevant calculations interrupt that flow, and limited spacing between imports and the class slightly reduces visual separation.

Run 2

Code Structure: Imports, class configuration, and the property are logically organized, but several unused imports and unrelated score calculations introduce clutter. Nesting: Very shallow, with a single conditional and a straightforward fallback. Clarity of intent: The class and property names, type annotations, and documentation clearly explain response behavior; the unused average calculation distracts from the property's purpose. Code length: The implementation is concise, although the lengthy class documentation and irrelevant statements increase reading effort. Action granularity: Each statement performs one action, making individual lines easy to follow. Reading flow: Configuration followed by a documented property provides a natural progression, and the fallback comment is helpful. However, unrelated arithmetic interrupts the flow, and limited spacing between imports and the class slightly reduces visual separation.

Run 3

Code Structure: Imports, class configuration, and the property are logically organized, but several unused imports and unrelated score calculations add clutter. Nesting: Minimal nesting, with a single conditional and a straightforward fallback. Clarity of intent: The class and property names, docstrings, and fallback comment clearly explain response behavior; the unused average calculation distracts from that purpose. Code length: The implementation is concise, although historical documentation and irrelevant calculations make the excerpt longer than necessary. Action granularity: Each statement performs one action, making individual lines easy to follow. Reading flow: The progression from configuration to property behavior is natural, but the unrelated calculations interrupt the otherwise direct configuration lookup and fallback.