Sample

pyint-62bd1b788eef-I04

Replace names with deterministic minifier-style shortest identifiers

Matched original source

Lines126

Scores

MethodScoreScale
Posnett0.0010–1; higher is more readable
Dorn0.5870–1; higher is more readable
Mi0.4640–1; higher is more readable
LLOC35Logical lines; fewer is more readable
DeepSeek V4 Pro80–20; mean of three runs
GPT-6.1 Sol80–20; mean of three runs
BTTF0.3770–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: """Subclass this class and override :meth:`dispatch_request` to create a generic class-based view. Call :meth:`as_view` to create a view function that creates an instance of the class with the given arguments and calls its ``dispatch_request`` method with any URL variables. See :doc:`views` for a detailed guide. .. code-block:: python class Hello(View): init_every_request = False def dispatch_request(self, name): return f"Hello, {name}!" app.add_url_rule( "/hello/<name>", view_func=Hello.as_view("hello") ) Set :attr:`methods` on the class to change what methods the view accepts. Set :attr:`decorators` on the class to apply a list of decorators to the generated view function. Decorators applied to the class itself will not be applied to the generated view function! Set :attr:`init_every_request` to ``False`` for efficiency, unless you need to store request-global data on ``self``. """ #: The methods this view is registered for. Uses the same default #: (``["GET", "HEAD", "OPTIONS"]``) as ``route`` and #: ``add_url_rule`` by default. methods: t.ClassVar[t.Collection[str] | None] = None #: Control whether the ``OPTIONS`` method is handled automatically. #: Uses the same default (``True``) as ``route`` and #: ``add_url_rule`` by default. provide_automatic_options: t.ClassVar[bool | None] = None #: A list of decorators to apply, in order, to the generated view #: function. Remember that ``@decorator`` syntax is applied bottom #: to top, so the first decorator in the list would be the bottom #: decorator. #: #: .. versionadded:: 0.8 decorators: t.ClassVar[list[t.Callable[..., t.Any]]] = [] #: Create a new instance of this view class for every request by #: default. If a view subclass sets this to ``False``, the same #: instance is used for every request. #: #: A single instance is more efficient, especially if complex setup #: is done during init. However, storing data on ``self`` is no #: longer safe across requests, and :data:`~flask.g` should be used #: instead. #: #: .. versionadded:: 2.2 init_every_request: t.ClassVar[bool] = True def a(self) -> ft.ResponseReturnValue: """The actual view function behavior. Subclasses must override this and return a valid response. Any variables from the URL rule are passed as keyword arguments. """ raise NotImplementedError() @classmethod def b( cls, c: str, *d: t.Any, **e: t.Any ) -> ft.RouteCallable: """Convert the class into a view function that can be registered for a route. By default, the generated view will create a new instance of the view class for every request and call its :meth:`dispatch_request` method. If the view class sets :attr:`init_every_request` to ``False``, the same instance will be used for every request. Except for ``name``, all other arguments passed to this method are forwarded to the view class ``__init__`` method. .. versionchanged:: 2.2 Added the ``init_every_request`` class attribute. """ if cls.init_every_request: def view(**i: t.Any) -> ft.ResponseReturnValue: j = view.view_class( # type: ignore[attr-defined] *class_args, **class_kwargs ) return current_app.ensure_sync(j.a)(**i) # type: ignore[no-any-return] else: f = cls(*d, **e) # pyright: ignore def view(**k: t.Any) -> ft.ResponseReturnValue: return current_app.ensure_sync(self.a)(**k) # type: ignore[no-any-return] if cls.decorators: h.__name__ = c h.__module__ = cls.__module__ for g in cls.decorators: h = g(h) # We attach the view class to the view function for two reasons: # first of all it allows us to easily figure out what class-based # view this thing came from, secondly it's also used for instantiating # the view class so you can actually replace it with something else # for testing purposes and debugging. h.view_class = cls # type: ignore h.__name__ = c h.__doc__ = cls.__doc__ h.__module__ = cls.__module__ h.methods = cls.methods # type: ignore h.provide_automatic_options = cls.provide_automatic_options # type: ignore return h

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.1812.586−59.815
Source linesThe number of non-empty source lines.126+50.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.499−6.749

Intercept 8.87 + feature contributions = -7.294 (log-odds).
Score = sigmoid(-7.294) = 0.001.

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.127−3.46
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.125.945+1.351
Indentation frequencyHow rapidly indentation changes from line to line.46+0.854
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.89.984+0.647
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.031+0.638
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.89.969−0.145

Intercept 0.07 + feature contributions = 0.352 (log-odds).
Score = sigmoid(0.352) = 0.587.

Score0.464
Score35
Run 1

The code is difficult to read due to obfuscated names (a, b, c, d, e, h, i, j, k), unclear variable purpose, and inconsistent flow. The structure is somewhat logical but deeply hampered by name ambiguity. The View class documentation is long and somewhat helpful, but the method 'a' replacing 'dispatch_request' and 'b' replacing 'as_view' destroys clarity. Nesting is moderate, but the inner function definitions and conditional branches reduce readability. Action granularity is mostly one action per line, but variable naming forces re-reading. The reading flow is unnatural because readers must map nonsensical names to concepts. The code is concise but overly cryptic.

Run 2

The code shows moderate readability but has significant issues. While the class structure and docstrings are clear, the actual implementation is severely compromised by obfuscated naming: single-letter variables (a, b, c, d, e, f, g, h, i, j, k) replace what should be descriptive names like 'dispatch_request', 'as_view', 'name', 'view', 'decorator', etc. This makes the code nearly impossible to follow without context. Additionally, the as_view method is overly long, mixing multiple responsibilities and action granularity (multiple operations per line, like h.__name__ assignments chained together). The nesting is moderate but worsened by undefined variable references (class_args, class_kwargs, self) suggesting incomplete or broken code. Type hints and comments are helpful, but don't compensate for the poor naming and tangled flow.

Run 3

The code has good documentation and type hints, but suffers from poor naming and structural obfuscation. Methods 'a' and 'b' are not descriptive, making intent unclear. Variable names like 'f', 'g', 'h', 'i', 'j', 'k', 'd', 'e' obscures logic. The 'view' function is defined in two separate branches, causing duplication and impacting reading flow. There are multiple assignments to 'h.__name__' and 'h.__module__' in different places, which is disorganized. The 'h' variable is modified extensively without clear context. Nesting is moderate, but the mixed logic (branching, closures, decoration) reduces clarity. Type hints are helpful but can't compensate for vague identifiers and fragmented flow.

Run 1

Code Structure: Class attributes and methods are logically organized, but inconsistent identifiers undermine coherence. Nesting: Moderate and manageable, with conditional closures and a decorator loop. Clarity of intent: Documentation explains the intended design, but single-letter names obscure roles, and references to undefined class_args, class_kwargs, self, and h make the implementation difficult to follow. Documentation also references dispatch_request and as_view while the actual methods are named a and b. Code length: Executable code is reasonably concise, although extensive documentation becomes less useful because it conflicts with the implementation. Action granularity: Mostly one action per line, with clear separation of assignments and calls. Reading flow: The overall sequence is natural, but mismatched names and disconnected references repeatedly interrupt comprehension.

Run 2

Code Structure: Class attributes and methods are logically organized, but inconsistent identifiers undermine the implementation. Nesting: Moderate and manageable, with conditional branches, inner functions, and a decorator loop. Clarity of intent: Documentation explains the intended design, but single-letter names obscure roles. References to undefined class_args, class_kwargs, self, and h break traceability; documented dispatch_request and as_view names also conflict with a and b. Code length: Executable code is reasonably concise, although extensive documentation dominates and sometimes describes names absent from the implementation. Action granularity: Generally good, with one assignment or operation per line. Reading flow: The progression from configuration to view creation and metadata assignment is natural, but readers must repeatedly reconcile mismatched names and unexplained references. Overall, strong organization and documentation are substantially weakened by ambiguous naming and disconnected variable usage.

Run 3

Code Structure: Class attributes and methods are logically organized, but inconsistent identifiers disconnect the generated view from decoration and return logic. Nesting: Moderate nesting from conditionals, closures, and a decorator loop remains manageable. Clarity of intent: Documentation explains the intended design, but single-letter names obscure roles, and references to undefined class_args, class_kwargs, self, and h make actual behavior difficult to follow. Documentation also names dispatch_request and as_view while the methods are named a and b. Code length: Executable code is reasonably concise, although extensive documentation overwhelms the small implementation and sometimes contradicts it. Action granularity: Most lines perform one clear operation, with readable multiline calls. Reading flow: The progression from configuration to construction, decoration, and metadata assignment is natural in principle, but naming inconsistencies and broken references repeatedly interrupt comprehension.