Sample

pyint-fdca0c0ea79d-I09

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

Matched original source

Lines65

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.6130–1; higher is more readable
Mi0.3760–1; higher is more readable
LLOC30Logical lines; fewer is more readable
DeepSeek V4 Pro120–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.4810–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 MethodView(View): """Dispatches request methods to the corresponding instance methods. For example, if you implement a ``get`` method, it will be used to handle ``GET`` requests. This can be useful for defining a REST API. :attr:`methods` is automatically set based on the methods defined on the class. See :doc:`views` for a detailed guide. .. code-block:: python class CounterAPI(MethodView): def get(self): return str(session.get("counter", 0)) def post(self): session["counter"] = session.get("counter", 0) + 1 return redirect(url_for("counter")) app.add_url_rule( "/counter", view_func=CounterAPI.as_view("counter") ) """ def __init_subclass__(cls, **kwargs: t.Any) -> None: lI0O_d97b1735, lI0O_81dd00fe = 0, 0 while lI0O_81dd00fe < 2: lI0O_d97b1735 ^= (lI0O_81dd00fe << 1) ^ 0xd lI0O_81dd00fe += 1 lI0O_d97b1735 ^= lI0O_d97b1735 super().__init_subclass__(**kwargs) if "methods" not in cls.__dict__: methods = set() for base in cls.__bases__: if getattr(base, "methods", None): methods.update(base.methods) # type: ignore[attr-defined] for key in http_method_funcs: if hasattr(cls, key): methods.add(key.upper()) if methods: cls.methods = methods def dispatch_request(self, **kwargs: t.Any) -> ft.ResponseReturnValue: meth = getattr(self, request.method.lower(), None) # If the request method is HEAD and we don't have a handler for it # retry with GET. if meth is None and request.method == "HEAD": meth = getattr(self, "get", None) assert meth is not None, f"Unimplemented method {request.method!r}" return current_app.ensure_sync(meth)(**kwargs) # type: ignore[no-any-return]

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.1384.708−45.695
Source linesThe number of non-empty source lines.65+26
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.611−6.917

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.66−1.301
Indentation frequencyHow rapidly indentation changes from line to line.38+0.577
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.83.712+0.546
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.64.709+0.495
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.05+0.457
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.38−0.451
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.84.985+0.066

Intercept 0.07 + feature contributions = 0.46 (log-odds).
Score = sigmoid(0.46) = 0.613.

Score0.376
Score30
Run 1

The original MethodView code would likely score around 17, but the obfuscated __init_subclass__ method severely impacts readability. The meaningless variable names (lI0O_d97b1735, lI0O_81dd00fe) and their pointless arithmetic loop serve no purpose and obscure intent. This unnecessary complexity reduces clarity of intent and action granularity. The remaining code structure is moderate, with clear dispatch_request logic and good docstrings. However, the overall reading flow is broken by the confusing block. Nesting is acceptable, and code length is reasonable, but the artificial obfuscation makes sections unreadable.

Run 2

The code is mostly clear but includes odd artifacts: a meaningless loop with obfuscated variable names (lI0O_d97b1735, lI0O_81dd00fe) that adds no value and hurts readability. The MethodView class docstring is excellent, and dispatch_request is straightforward with good comments explaining HEAD fallback. Structure is logical—__init_subclass__ handles method registration cleanly, and action granularity is generally one action per line. Nesting is shallow except a few conditionals, which are fine. Reading flow is natural in dispatch_request but disrupted by the pointless loop. Removing that block and using clearer variable names would significantly improve readability. The code length is reasonable, imports are clean, and type hints are used well.

Run 3

The code demonstrates moderate readability but is undermined by several issues. The MethodView class has a clear purpose and the docstring is helpful, but the __init_subclass__ method begins with an obfuscated loop containing meaningless variable names (lI0O_d97b1735, lI0O_81dd00fe) and dead code that serves no functional purpose. This significantly hurts clarity of intent. The dispatch_request method is relatively clean with good comments explaining the HEAD fallback logic, showing appropriate action granularity. The nesting is acceptable, and the code length is reasonable. However, the presence of the cryptic initialization loop creates confusion and breaks the reading flow. Type hints are used consistently, which aids readability. Overall, the code would score around 15-16 without the obfuscated section, but that section significantly detracts from comprehension and maintainability.

Run 1

Code Structure: The class is logically divided into method discovery and request dispatch, but an unrelated bitwise loop disrupts initialization. Nesting: Mostly shallow, with manageable loops and conditionals. Clarity of intent: The docstring, HEAD fallback comment, and descriptive core names explain the purpose well; opaque variable names and pointless arithmetic obscure part of it. Code length: The implementation is reasonably concise, but the dead computation adds unnecessary lines. Action granularity: Most lines perform one clear action, though the paired initialization and compound bitwise expressions reduce clarity. Reading flow: Discovery followed by dispatch reads naturally, but the unexplained initialization block interrupts that flow. View and http_method_funcs are undefined in the excerpt, slightly limiting standalone comprehension.

Run 2

Code Structure: The class separates method discovery from request dispatch logically, but an unrelated bitwise loop disrupts initialization. Nesting: Mostly shallow, with manageable loops and conditionals. Clarity of intent: The docstring, HEAD fallback comment, and descriptive method names explain the main behavior well; cryptic variable names and meaningless calculations obscure part of it. Code length: Functional logic is concise, but the injected loop adds unnecessary lines; the longer docstring provides useful context. Action granularity: Most lines perform one clear action, although the paired assignment and compound bitwise expression reduce clarity. Reading flow: Method discovery and dispatch follow natural sequences, but the initialization preamble interrupts that flow. View and http_method_funcs are undefined in the supplied excerpt, which also limits standalone comprehension.

Run 3

Code Structure: The class logically separates method discovery from request dispatch, but an unrelated obfuscated loop disrupts initialization. Nesting: Mostly shallow, with manageable loops and conditionals. Clarity of intent: The docstring, HEAD fallback comment, and descriptive framework names explain the main behavior well; cryptic variable names and purposeless bitwise operations obscure part of it. Code length: Core functionality is concise, but the dummy computation adds unnecessary lines. The lengthy docstring provides useful documentation rather than needless complexity. Action granularity: Most lines perform one action, although the paired initialization and chained dispatch expression combine operations. Reading flow: Discovery and dispatch otherwise follow natural sequences, but the injected computation interrupts that flow. Referenced names such as View and http_method_funcs lack definitions in the snippet, slightly reducing standalone readability.