Sample
pyint-12c5e9767d0d-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.784 | 0–1; higher is more readable |
| Mi | 0.339 | 0–1; higher is more readable |
| LLOC | 25 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.56 | 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. | 54 | +21.6 |
| 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.485 | −6.728 |
Intercept 8.87 + feature contributions = -14.769 (log-odds).
Score = sigmoid(-14.769) = 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. | 55 | −0.911 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 84.982 | +0.567 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.047 | +0.488 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 53.802 | +0.342 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 29 | +0.266 |
| 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.945 | +0.067 |
Intercept 0.07 + feature contributions = 1.287 (log-odds).
Score = sigmoid(1.287) = 0.784.
| Score | 0.339 |
|---|
| Score | 25 |
|---|
Run 1
The code is well-structured and readable. The MethodView class has a clear purpose with a useful docstring and example. __init_subclass__ is logically organized: it collects HTTP methods from base classes and class attributes in a flat, understandable way. Nesting is minimal, with only one level of if-statements and loops. Variable names are descriptive (e.g., 'meth', 'methods', 'key'). Action granularity is strong — most lines perform a single operation, though the final dispatch_request line combines three actions (assertion, method lookup, and call) which slightly reduces clarity. Reading flow is natural: imports, class definition, subclass initialization, then dispatch logic. The code is concise without being overly compressed. Minor deductions: the type-ignore comments add slight noise, and the dispatch_request final line could be split for better readability. Overall, this is highly readable production-quality code.
Run 2
The code is well-structured and readable. It has a clear class hierarchy with MethodView extending View, a descriptive docstring, and logical separation of concerns. Nesting is minimal—only a couple of levels deep in the __init_subclass__ method. The intent is unambiguous: it maps HTTP methods to handler methods and handles HEAD fallback. Code length is concise without sacrificing clarity. Action granularity is generally one action per line, though the __init_subclass__ has a slightly dense loop section. Reading flow is natural, with a docstring, initialization logic, then request dispatch. Minor improvements could include simplifying the nested loop logic and avoiding the type ignore comments, but overall the code is highly readable.
Run 3
The code is well-structured with clear separation of concerns, containing a class with two focused methods. Nesting is shallow (max 2 levels) and action granularity is good, with one primary operation per line. The dispatch_request method is concise and readable. However, minor issues reduce the score: the __init_subclass__ method loops through bases and attribute checks, adding slight complexity; the use of type-ignore comments indicates potential type-hinting gaps; and the inline comment about HEAD fallback breaks reading flow slightly. The docstring is thorough but lengthy, which impacts conciseness. Overall, intent is clear and the code follows logical patterns, but the metaclass-style method collection logic could benefit from extraction into a helper method for improved readability.
Run 1
Code Structure: The class cleanly separates method discovery from request dispatch. Nesting: Dispatch is mostly flat, but subclass initialization contains moderately nested loops and conditionals. Clarity of intent: The descriptive docstring, type annotations, and HEAD fallback comment explain the purpose well; abbreviated names such as meth and external definitions such as View and http_method_funcs require some context. Code length: The implementation is concise, while the longer docstring provides useful documentation and an example. Action granularity: Statements generally perform one action per line, although the final return combines synchronization wrapping and invocation. Reading flow: Discovery and dispatch follow a natural sequence, with minor spacing limitations between imports, the class, and its first method.
Run 2
Code Structure: Clearly separates automatic method discovery from request dispatch. Nesting: Dispatch is mostly flat, while subclass initialization has moderate nesting through conditions and loops. Clarity of intent: The descriptive docstring, type annotations, and HEAD fallback comment explain the purpose 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, and the longer docstring provides useful documentation rather than unnecessary code. Action granularity: Statements generally perform one action per line, though the final chained call combines synchronization and invocation. Reading flow: Discovery proceeds logically from inherited methods to locally available handlers, followed by straightforward dispatch; additional spacing between imports, the class, and methods would improve visual separation.
Run 3
Code Structure: Two clearly separated methods organize class setup and request dispatch logically. Nesting: Dispatch is flat, while subclass initialization has moderate nesting through conditionals and loops. Clarity of intent: The descriptive docstring, type annotations, and HEAD fallback comment explain behavior well; abbreviated names such as 'meth' and external definitions such as View and http_method_funcs require some context. Code length: Implementation is concise, and the longer docstring provides useful documentation rather than unnecessary code. Action granularity: Statements generally perform one action per line, though the final expression combines handler synchronization and invocation. Reading flow: Setup proceeds naturally from inherited methods to locally implemented handlers, followed by straightforward dispatch logic. Additional spacing between imports, the class, and its docstring and methods would improve visual separation.