Sample

pyint-f15a07e9d32a-I01

Remove comments and docstrings

Matched original source

Lines80

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.6790–1; higher is more readable
Mi0.7620–1; higher is more readable
LLOC32Logical lines; fewer is more readable
DeepSeek V4 Pro13.670–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.5690–1; higher is more readable

Views

Source code

from __future__ import annotations import typing as t from . import typing as ft from .globals import current_app from .globals import request class View: methods: t.ClassVar[t.Collection[str] | None] = None provide_automatic_options: t.ClassVar[bool | None] = None decorators: t.ClassVar[list[t.Callable[..., t.Any]]] = [] init_every_request: t.ClassVar[bool] = True def dispatch_request(self) -> ft.ResponseReturnValue: raise NotImplementedError() @classmethod def as_view( cls, name: str, *class_args: t.Any, **class_kwargs: t.Any ) -> ft.RouteCallable: if cls.init_every_request: def view(**kwargs: t.Any) -> ft.ResponseReturnValue: self = view.view_class( *class_args, **class_kwargs ) return current_app.ensure_sync(self.dispatch_request)(**kwargs) else: self = cls(*class_args, **class_kwargs) def view(**kwargs: t.Any) -> ft.ResponseReturnValue: return current_app.ensure_sync(self.dispatch_request)(**kwargs) if cls.decorators: view.__name__ = name view.__module__ = cls.__module__ for decorator in cls.decorators: view = decorator(view) view.view_class = cls view.__name__ = name view.__doc__ = cls.__doc__ view.__module__ = cls.__module__ view.methods = cls.methods view.provide_automatic_options = cls.provide_automatic_options return view

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.1740.786−57.446
Source linesThe number of non-empty source lines.80+32
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.168−6.253

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

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.80+2.03
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.81−1.832
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.79.831+0.706
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
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.81.951+0.194
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.098−0.014

Intercept 0.07 + feature contributions = 0.748 (log-odds).
Score = sigmoid(0.748) = 0.679.

Score0.762
Score32
Run 1

The code demonstrates moderate readability but is significantly impacted by inconsistent formatting and excessive whitespace. The View class structure is logically organized with clear class attributes and methods, but the numerous blank lines between attributes disrupt visual cohesion. The as_view method has reasonable nesting depth (2-3 levels) but lacks clear logical separation between different sections. The intent is discernible - creating view functions from class-based views - but the use of 'view.view_class' attribute assignment is slightly unclear without context. Code length is appropriate for the functionality, though the decorator handling section could benefit from comments explaining purpose. Action granularity is inconsistent: some lines contain multiple operations with trailing whitespace, while others have excessive line breaks. Reading flow is interrupted by irregular spacing patterns. The code would benefit from consistent formatting, removal of excessive blank lines and trailing spaces, and brief comments explaining key attributes and decorator application logic.

Run 2

The code is generally readable with clear class-level annotations, logical structure, and reasonable method lengths. The as_view method has a straightforward branch based on init_every_request, and variable naming is consistent. However, readability is slightly reduced by some unnecessary vertical spacing (multiple blank lines between class attributes) and trailing whitespace, which can be distracting. The nested 'view' functions add a layer of indirection but are short and focused, keeping nesting shallow. Intent is mostly clear, and actions are broken into one per line in most places. The use of type hints improves clarity. Overall, it’s well-structured but could be cleaner with minor formatting fixes.

Run 3

The code has a clear purpose and logical structure but suffers from several readability issues. The excessive blank lines and trailing whitespace create visual noise and break the natural reading flow. Comments appear as empty placeholder blocks (likely stripped documentation), reducing clarity of intent for class attributes. Nesting levels are reasonable, with only one level of conditional branching in as_view(). Action granularity is mixed: some lines combine multiple operations (e.g., self = view.view_class(...) followed by method call on the same line), while others are appropriately separated. Code length is acceptable overall, though the view function definitions could be more concise by extracting common logic. The method-naming and Flask conventions are clear to experienced developers but may be ambiguous to newcomers. The reading flow is disrupted by the formatting issues rather than structural problems, and the class attribute annotations suggest intended documentation that is missing, hindering maintainability.

Run 1

Code Structure: Class attributes, dispatch interface, and callable construction are logically organized. Nesting: Moderate nesting from conditional inner functions and a decorator loop remains manageable. Clarity of intent: Descriptive names and type annotations communicate the purpose, but missing documentation makes instance lifecycle, dynamic callable attributes, and decorator handling less obvious. Code length: The implementation is reasonably concise, though excessive blank lines unnecessarily inflate its visual length and the inner functions repeat dispatch logic. Action granularity: Statements generally perform one action per line, with a compact chained dispatch expression. Reading flow: Execution follows a sensible sequence from instance creation to decoration and metadata assignment, but irregular whitespace and repeated metadata assignments interrupt smooth reading.

Run 2

Code Structure: Imports, class configuration, and methods are logically organized, although excessive blank lines fragment the layout. Nesting: Moderate nesting in conditional branches, inner functions, and the decorator loop remains manageable. Clarity of intent: Descriptive names and type annotations communicate most responsibilities, but instance lifecycle choices, dynamic function attributes, and decorator handling lack explanation. Code length: The implementation is reasonably concise, but unnecessary whitespace substantially increases its visual length, and the inner view functions duplicate dispatch logic. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: Execution proceeds naturally from instance creation through decoration to metadata assignment, but repeated metadata assignments and large whitespace gaps interrupt scanning.

Run 3

Code Structure: Class attributes and methods are logically organized, with a coherent view-factory implementation. Nesting: Moderate nesting from conditional branches and inner functions is manageable. Clarity of intent: Descriptive names and type annotations help, but missing documentation makes lifecycle behavior, dynamic function attributes, and decorator handling less obvious. Code length: The implementation is reasonably concise, although excessive blank lines inflate its visual length and the two inner functions repeat dispatch logic. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: Execution proceeds naturally from instance creation to decoration and metadata assignment, but irregular whitespace, trailing spaces, and the split constructor call interrupt scanning.