Sample
pyint-bc9ca2593629-I01
Remove comments and docstrings
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.642 | 0–1; higher is more readable |
| Mi | 0.656 | 0–1; higher is more readable |
| LLOC | 24 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 12.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.33 | 0–20; mean of three runs |
| BTTF | 0.471 | 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. | 1156.494 | −38.164 |
| Source linesThe number of non-empty source lines. | 36 | +14.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.326 | −6.489 |
Intercept 8.87 + feature contributions = -21.383 (log-odds).
Score = sigmoid(-21.383) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 36 | +0.508 |
| 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. | 75 | +0.489 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 36 | −0.238 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 35.763 | +0.09 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.09 | +0.072 |
Intercept 0.07 + feature contributions = 0.584 (log-odds).
Score = sigmoid(0.584) = 0.642.
| Score | 0.656 |
|---|
| Score | 24 |
|---|
Run 1
The code is moderately readable but has several issues. Structure is logical but dense; the __init_subclass__ method handles multiple responsibilities in one block. Nesting is acceptable but the double loop and conditional logic create moderate complexity. Intent is mostly clear but could be more explicit with comments explaining the HEAD fallback. Code length is reasonable but some lines are unnecessarily long (e.g., the assert line). Action granularity is mixed - some lines combine multiple operations. Reading flow is somewhat disrupted by whitespace inconsistencies and the cryptic variable name 'meth' instead of 'method'. The blank lines with trailing whitespace and inconsistent spacing also hurt readability. The logic for collecting methods could be extracted into a helper function for better organization.
Run 2
The code is moderately readable but has several issues. Structure is logical (subclass method setup, dispatch handling), but the `__init_subclass__` method contains nested loops and conditionals that obscure intent. Nesting is moderate—two loops and multiple ifs within a method. Intent is fairly clear for HTTP method resolution but the `methods` set merging logic is implicit. Code length is reasonable, though the blank lines and trailing spaces suggest formatting problems. Action granularity is mostly one-action-per-line, but lines like `methods.update(base.methods)` with trailing spaces and the combined `meth = getattr(...)` assignment are fine. Reading flow is somewhat disrupted by blank lines, trailing whitespace, and the oddly formatted condition `if meth is None and request.method == "HEAD":`. The assertion is clear. Overall, the code is understandable but not polished or especially readable; formatting and structural improvements would help significantly.
Run 3
The code defines a MethodView class with clear overall purpose but has readability issues. The structure is mostly logical: __init_subclass__ handles method inheritance/declaration, dispatch_request resolves and calls handlers. However, several details reduce clarity: the nesting in __init_subclass__ is moderately deep (method > if > for loops > if), the blank lines and trailing whitespace are inconsistent, and some lines contain multiple actions (e.g., adding to the methods set). The double comment markers look accidental. The intent of HEAD fallback is understandable, though the trailing whitespace and strange comment formatting obscure it. Variable names like 'meth' are common but compact. Code length is reasonable, but flow is slightly disrupted by formatting artifacts and minor inconsistency. It is readable but would benefit from cleaner formatting, reduced nesting (early returns/helpers), and more explicit comments.
Run 1
Code Structure: Two focused methods logically separate HTTP method discovery from request dispatch. Nesting: Moderate nesting in __init_subclass__, but short blocks remain easy to follow; dispatch_request is mostly flat. Clarity of intent: Method names, type annotations, and the HEAD-to-GET fallback communicate purpose well. However, 'meth' is abbreviated, and View and http_method_funcs are not defined or imported in the snippet. Code length: Concise overall, with unnecessary blank lines and trailing whitespace. Action granularity: Each statement performs a clear action, although the final return combines synchronization wrapping and invocation. Reading flow: Discovery proceeds naturally from inherited methods to implemented handlers, and dispatch follows lookup, fallback, validation, and execution.
Run 2
Code Structure: Two focused methods cleanly separate subclass method discovery from request dispatch. Nesting: Mostly shallow, although discovery uses nested loops and conditionals. Clarity of intent: Method names, type annotations, and the explicit HEAD-to-GET fallback communicate purpose well; the abbreviated variable 'meth' and externally defined View and http_method_funcs reduce standalone clarity. Code length: Compact with little unnecessary logic, but excessive blank lines and trailing whitespace add clutter. Action granularity: Each statement performs a distinct operation, with only the final synchronization-and-call expression combining steps. Reading flow: Execution proceeds naturally from collecting supported methods to selecting and invoking a handler, though inconsistent whitespace and missing explanatory context slightly interrupt readability.
Run 3
Code Structure: Two focused methods logically separate subclass method discovery from request dispatch. Nesting: Mostly shallow, although discovery uses loops with nested conditionals. Clarity of intent: Method names and HTTP handling communicate purpose, but the abbreviated variable 'meth', missing definitions for View and http_method_funcs, and lack of explanatory comments reduce standalone clarity. Code length: Concise overall, with unnecessary blank lines and trailing whitespace. Action granularity: Statements generally perform one action each; the final return combines synchronization and invocation but remains understandable. Reading flow: Discovery proceeds naturally from inherited methods to implemented handlers, and dispatch clearly handles the HEAD fallback before invocation. Inconsistent whitespace slightly interrupts an otherwise straightforward flow.