Sample
pyint-80c60901d2be-I05
Rewrite eligible decimal integer literals in hexadecimal notation
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 | 18 | 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 highly readable due to its clear structure and concise methods. The __init_subclass__ logic is logically organized, with two separate loops that have distinct responsibilities (inheriting base methods and adding HTTP method handlers). Nesting is minimal, with a flat structure inside the conditionals. Intent is explicit through descriptive variable names (meth, methods) and the docstring example. The code is concise but not overly terse, with each line performing a single logical action. The dispatch_request method follows a natural flow: retrieve handler, handle HEAD fallback, assert validity, and dispatch. Type hints and comments enhance clarity without adding noise. Minor deductions: the type: ignore comments are slightly distracting, and the set update line could be split for perfect one-action-per-line granularity.
Run 3
The code is highly readable with clear structure, minimal nesting, and explicit intent. The MethodView class is well-organized with a descriptive docstring and separated concerns. The __init_subclass__ method uses flat conditionals and loops with clear variable names. dispatch_request is concise, handles the HEAD fallback explicitly, and uses assertion for an invariant. Each line performs a single logical action, and comments add context without noise. Type hints improve clarity. The only minor concern is the type: ignore comments, but they are justified for framework internals.
Run 1
Code Structure: Two focused methods logically separate supported-method discovery from request dispatch. Nesting: Dispatch is flat, while subclass initialization has moderate, manageable nesting. Clarity of intent: The comprehensive docstring and HEAD fallback comment explain behavior well; dynamic attribute lookup and externally defined View and http_method_funcs require some context. Code length: Implementation is concise, with documentation adding useful examples rather than unnecessary complexity. Action granularity: Statements generally perform one action each, though the final return combines synchronous adaptation and handler invocation. Reading flow: Initialization proceeds naturally from inherited methods to implemented handlers, and dispatch follows lookup, fallback, validation, and execution. Minor readability limitations include the abbreviated variable meth and framework-specific typing suppressions.
Run 2
Code Structure: Two well-separated methods organize method discovery and request dispatch logically. Nesting: Subclass initialization has moderate nesting through conditionals and loops, while dispatch remains flat. Clarity of intent: The descriptive docstring, type annotations, and HEAD fallback comment make behavior clear; abbreviated names such as meth and ft are less explicit, and View and http_method_funcs are not defined in the snippet. Code length: Implementation is concise; the lengthy docstring provides useful explanation and an example rather than unnecessary code. Action granularity: Most lines perform one action, though the final return combines handler adaptation and invocation. Reading flow: Initialization proceeds naturally from inherited methods to locally available handlers, and dispatch flows from lookup to fallback, validation, and execution. Additional spacing between imports and the class would improve visual separation.
Run 3
Code Structure: Responsibilities are logically separated between subclass method discovery and request dispatch. Nesting: Discovery uses moderate nesting (conditional, loop, conditional), while dispatch remains flat and easy to follow. Clarity of intent: Descriptive names, type annotations, a thorough docstring, and the HEAD fallback comment explain behavior well. However, View and http_method_funcs are undefined in the provided snippet, requiring external context. Code length: Implementation is concise; the lengthy docstring adds useful documentation and an example rather than redundant code. Action granularity: Statements generally perform one action per line, although the final return combines synchronization and invocation. Reading flow: Imports, class documentation, initialization logic, and dispatch appear in a natural sequence. Dynamic attribute lookup and type-ignore comments introduce minor reading friction.