Sample
pyint-ca1f37ea3e51-I11
Split eligible integer literals into pairs of short-named intermediate 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.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 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 highly readable with clear logical organization. The MethodView class has a concise docstring with a helpful example. The __init_subclass__ method is well-structured: it checks for 'methods', collects inherited methods, adds HTTP method names, and assigns if non-empty. Nesting is minimal and flat. Intent is clear at each step. Action granularity is good—one logical action per line. The dispatch_request method follows a natural flow: retrieve handler, handle HEAD fallback, assert validity, and execute. Variable names like 'meth' and 'methods' are intuitive in context. Comments are concise and clarify edge cases without redundancy. Overall, the code balances conciseness with explicitness, making it easy to follow and maintain.
Run 3
The code is well-structured and readable. It has a clear class hierarchy and logical organization. The nesting in __init_subclass__ is shallow (two levels max) and manageable. The purpose is immediately clear from the docstring and method names. The code is concise without being terse, with appropriate use of helper constants and type hints. Most lines perform a single action, and the reading flow follows a natural top-to-bottom progression. The dispatch_request method is particularly clean, with clear comments explaining edge cases. The main minor deductions are the slightly complex logic in __init_subclass__ for combining HTTP methods and the reliance on a global request object, which slightly obscures data flow. Overall, this is exemplary Flask-style code that balances brevity with clarity.
Run 1
Code Structure: Two focused methods cleanly separate supported-method discovery from request dispatch. Nesting: Dispatch is flat; subclass initialization has moderate, manageable nesting through loops and conditionals. Clarity of intent: The detailed docstring, type annotations, and HEAD fallback comment explain behavior well, although 'meth' is abbreviated and View and http_method_funcs are not defined or imported in the snippet. Code length: Implementation is concise; the longer docstring provides useful context and an example rather than unnecessary repetition. Action granularity: Most lines perform one clear action, though the final return combines synchronization and invocation. Reading flow: Initialization proceeds logically from inherited methods to discovered handlers, while dispatch follows lookup, fallback, validation, and execution. Missing spacing between imports and the class slightly weakens presentation.
Run 2
Code Structure: The class cleanly separates method discovery from request dispatch. Nesting: Dispatch is flat, but subclass initialization contains moderately nested conditionals and loops. Clarity of intent: The docstring, type annotations, and HEAD fallback comment explain behavior well; abbreviated names such as 'meth' and external definitions of View and http_method_funcs slightly reduce standalone clarity. Code length: Implementation is concise, while the longer docstring provides useful examples rather than redundant explanation. Action granularity: Most lines perform one clear action; the final return combines synchronization and invocation but remains understandable. Reading flow: Imports, class documentation, initialization, and dispatch follow a logical order, although additional spacing between imports and the class would improve visual separation.
Run 3
Code Structure: Responsibilities are cleanly divided between method discovery and request dispatch. Nesting: Discovery uses moderate nesting, but dispatch remains flat and easy to follow. Clarity of intent: The docstring, type hints, and HEAD fallback comment explain behavior well; abbreviated names such as meth and external definitions such as View and http_method_funcs slightly reduce standalone clarity. Code length: Implementation is concise, with a longer but useful documentation example. Action granularity: Statements generally perform one action per line, although the final return combines synchronization and invocation. Reading flow: Imports, class documentation, subclass initialization, and dispatch follow a natural order, with whitespace separating logical steps.