Sample
pyint-65d306754447-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.785 | 0–1; higher is more readable |
| Mi | 0.411 | 0–1; higher is more readable |
| LLOC | 25 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 0–20; mean of three runs |
| BTTF | 0.561 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (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. | 1167.022 | −38.512 |
| Source linesThe number of non-empty source lines. | 60 | +24 |
| 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.487 | −6.731 |
Intercept 8.87 + feature contributions = -12.372 (log-odds).
Score = sigmoid(-12.372) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 61 | −1.123 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 84.967 | +0.566 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.047 | +0.488 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 59.802 | +0.426 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 33 | +0.404 |
| 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. | 85 | +0.065 |
Intercept 0.07 + feature contributions = 1.295 (log-odds).
Score = sigmoid(1.295) = 0.785.
| Score | 0.411 |
|---|
| Score | 25 |
|---|
Run 1
The code is well-structured and readable. The MethodView class has a clear purpose, with a helpful docstring and example. __init_subclass__ is logically organized, using an early check to avoid unnecessary work, followed by two clear collection phases (base classes and HTTP methods). Nesting is moderate: the 'if methods not in cls.__dict__' block contains nested loops, but the logic remains followable. Variable names like 'meth' and 'methods' are concise but contextually clear. Action granularity is appropriate—each line performs a distinct operation, and the conditional HEAD fallback is commented for clarity. The dispatch_request method is flat and direct, with a precise assertion message. Minor readability costs include the type: ignore comments and the somewhat terse 'meth' name, but these are consistent with the surrounding Flask codebase style. Overall, the code balances conciseness with clarity effectively.
Run 2
The code is well-structured and readable. It uses clear class and method names, maintains a flat structure with minimal nesting, and has concise comments explaining non-obvious behavior (HEAD fallback). The dispatch_request method follows a logical flow: retrieve handler, handle edge case, assert, and dispatch. The __init_subclass__ method is slightly more complex due to the loop and conditional logic, but remains understandable. Type hints and docstrings improve clarity. The code is concise without sacrificing readability, and each line performs a single action. Overall, it adheres to good practices for maintainable and readable code.
Run 3
The code is highly readable with clear structure and documentation. The MethodView class serves a single purpose and the __init_subclass__ method logically organizes method detection through two sequential loops with clear intent. Nesting is minimal—only one level deep in the loops and conditional blocks. Action granularity is appropriate, with one distinct operation per line. The docstring provides excellent context with a practical example, though it's somewhat lengthy. The dispatch_request method has clear flow: retrieve method, handle HEAD fallback, assert existence, and dispatch. Type hints and comments add clarity. Minor deductions: the type ignore comments add slight noise, and the methods update loop could potentially be simplified, but overall the code demonstrates exemplary readability with natural reading flow from method resolution to request handling.
Run 1
Code Structure: Two focused methods cleanly separate supported-method discovery from request dispatch. Nesting: Dispatch is flat, while subclass initialization uses moderate, manageable nesting. Clarity of intent: The class docstring, HEAD fallback comment, and descriptive method names explain behavior well; 'meth' is slightly abbreviated, and View and http_method_funcs are not defined in the snippet. Code length: Implementation is concise; the longer docstring provides useful context and an example. Action granularity: Most lines perform one action, although the final return combines synchronization and invocation. Reading flow: Execution follows a natural progression from initialization to handler selection, fallback, validation, and invocation, with whitespace separating logical steps.
Run 2
Code Structure: Two focused methods cleanly separate handler discovery from request dispatch. Nesting: Subclass initialization has moderate nesting through conditions and loops, while dispatch remains flat. Clarity of intent: The descriptive docstring, type annotations, and HEAD fallback comment explain behavior well; abbreviated names such as 'meth' and 'ft', and externally defined View and http_method_funcs, slightly reduce standalone clarity. Code length: Implementation is concise; the lengthy docstring provides useful documentation and an example rather than redundant logic. Action granularity: Each line generally performs one clear action, although the final chained call combines synchronization and invocation. Reading flow: Initialization proceeds naturally from inherited methods to discovered handlers, and dispatch flows clearly from lookup through fallback, validation, and execution.
Run 3
Code Structure: Two focused methods logically separate HTTP-method discovery from request dispatch. Nesting: Discovery has moderate nesting through a conditional, loops, and inner checks; dispatch remains flat. Clarity of intent: The descriptive docstring, type annotations, and HEAD fallback comment explain behavior well, although View and http_method_funcs are undefined in the provided snippet, and meth is an abbreviated name. Code length: Implementation is concise; the lengthy docstring provides useful context rather than redundant detail. Action granularity: Each statement performs a clear action, with only the final chained call combining handler adaptation and invocation. Reading flow: Discovery proceeds naturally from inherited methods to implemented handlers, and dispatch follows lookup, fallback, validation, and execution. Minor spacing improvements between imports and the class would improve presentation.