Sample

pyint-4371fa4f30e3-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines46

Scores

MethodScoreScale
Posnett0.8730–1; higher is more readable
Dorn0.8210–1; higher is more readable
Mi0.3930–1; higher is more readable
LLOC19Logical lines; fewer is more readable
DeepSeek V4 Pro17.670–20; mean of three runs
GPT-6.1 Sol17.330–20; mean of three runs
BTTF0.6890–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(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.552.943−18.247
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.732−7.098

Intercept 8.87 + feature contributions = 1.925 (log-odds).
Score = sigmoid(1.925) = 0.873.

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.017+0.773
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.936+0.598
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.852+0.231
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.86.894−0.015

Intercept 0.07 + feature contributions = 1.52 (log-odds).
Score = sigmoid(1.52) = 0.821.

Score0.393
Score19
Run 1

This code is highly readable. It demonstrates excellent structure with a clear class definition, well-documented docstrings, and logical imports. The nesting is minimal, with only one conditional in the `max` property. The intent is immediately clear - extending Werkzeug's Response class with Flask-specific defaults. Code length is concise and appropriate for the functionality. Action granularity is good - each line performs a single logical operation. The reading flow is natural, from imports through class definition to the property. The type hints and comments enhance understanding without cluttering. The only minor deduction is the slight complexity of the conditional in the `max` property, but it's well-commented and justified.

Run 2

The code is well-structured with clear separation of imports, a class definition, and methods. Nesting is minimal, with only one conditional in the 'max' property. Intent is clear from descriptive naming, docstrings, and comments. Code length is appropriate, with no unnecessary repetition. Action granularity is mostly one action per line, though the return statements are concise. Reading flow is natural, with logical ordering of imports, class definition, default attributes, and methods. Minor deductions: the return line with an inline type-ignore comment, and the conditional property logic could be slightly clearer, but overall highly readable.

Run 3

The code is well-structured and highly readable. It logically organizes imports, class definition, attributes, and a property. Nesting is minimal with only one conditional inside the max property. Intent is clear through descriptive naming and helpful docstrings. Code is concise without unnecessary verbosity. Each line performs a single action, maintaining good action granularity. Reading flow is natural, progressing from imports to class attributes to methods. Minor deductions: the conditional return could arguably be inverted for slightly better flow, and the type ignore comments add minor noise. Overall, this is exemplary Flask-style code.

Run 1

Code Structure: Imports, class documentation, attributes, and the property are logically organized, although several imports are unused in this snippet. Nesting: A single conditional keeps the implementation shallow and easy to follow. Clarity of intent: Type annotations and documentation explain the configuration lookup and fallback, but naming the property 'max' rather than 'max_cookie_size' conflicts with its documented purpose and obscures its interface. Code length: Executable code is concise; the lengthy framework documentation and version notes add reading overhead. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: The progression from defaults to context-sensitive behavior is natural, and the early return makes the fallback clear. Limited spacing between imports and the class slightly weakens visual separation.

Run 2

Code Structure: Imports, class defaults, and a small property are logically organized, although several imports are unused in this snippet. Nesting: A single conditional keeps the implementation flat and easy to follow. Clarity of intent: Documentation explains the response class and configuration lookup well, but naming the property 'max' rather than 'max_cookie_size' obscures its purpose and conflicts with the documented interface. Code length: Executable code is concise; the extensive class docstring and version history add reading overhead. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: The configuration lookup followed by a superclass fallback reads naturally. Limited separation around the imports and class declaration, plus type-ignore annotations, slightly reduce visual polish.

Run 3

Code Structure: Imports, class defaults, and the property are logically organized, though several imports are unused in this snippet. Nesting: Minimal nesting and an early return keep the logic simple. Clarity of intent: Type hints, documentation, and the fallback comment explain the behavior well, but naming the property 'max' rather than 'max_cookie_size' obscures its purpose and appears inconsistent with the documented interface. Code length: Implementation is concise; the lengthy class documentation and version history slightly outweigh the small amount of logic. Action granularity: Each statement performs a single clear action. Reading flow: The progression from defaults to configuration lookup and superclass fallback is natural, although additional spacing between imports and the class would improve visual separation.