Sample
pyint-22c1a849cf92-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.792 | 0–1; higher is more readable |
| Mi | 0.365 | 0–1; higher is more readable |
| LLOC | 27 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14.67 | 0–20; mean of three runs |
| BTTF | 0.55 | 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. | 1248 | −41.184 |
| Source linesThe number of non-empty source lines. | 64 | +25.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.441 | −6.662 |
Intercept 8.87 + feature contributions = -13.376 (log-odds).
Score = sigmoid(-13.376) = 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. | 65 | −1.265 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 84.938 | +0.566 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 37 | +0.543 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 63.756 | +0.481 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.048 | +0.475 |
| 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. | 84.969 | +0.066 |
Intercept 0.07 + feature contributions = 1.334 (log-odds).
Score = sigmoid(1.334) = 0.792.
| Score | 0.365 |
|---|
| Score | 27 |
|---|
Run 1
The code is mostly readable with clear intent and good documentation. The class docstring is excellent, explaining purpose with examples. However, there are notable readability issues. The inverted conditional logic in `__init_subclass__` (`if not (...): pass else:`) and `dispatch_request` (`if not (...): pass else:`) is awkward and confusing - it should be simplified to positive conditions without the pass branches. The method names are clear, and the overall structure is logical. Lines are reasonably concise, with one action per line in most cases. The type hints improve clarity, though the `# type: ignore` comments are slightly noisy. Nesting is minimal, which is good. The `for base in cls.__bases__` loop is straightforward. Overall, the code is readable but the unnatural boolean logic patterns reduce clarity significantly.
Run 2
The code is generally readable but has a few awkward patterns that reduce clarity. The class docstring is excellent and clearly explains the purpose. Structure is logical with clear separation of concerns. However, there are two notably unclear conditional patterns using 'if not (condition): pass else:' which inverts normal logic flow - specifically 'if not ("methods" not in cls.__dict__): pass else:' and 'if not (meth is None and request.method == "HEAD"): pass else:'. These double-negative constructions with 'pass' branches make the intent harder to follow than necessary. Both could be rewritten as straightforward positive conditions. The __init_subclass__ method has moderate nesting depth (2-3 levels) which is acceptable. Variable names are clear ('meth', 'methods', 'base', 'key'). The code is concise and each line performs one logical action. Overall the code is readable but those inverted conditionals are unnecessary obstacles to understanding.
Run 3
The code has clear intent and follows a logical structure, but the control flow introduces artificial nesting and inverted conditions. The `if not (...) pass else` blocks in `__init_subclass__` and `dispatch_request` are confusing and reduce readability. These conditions could be simplified to positive, flat forms (e.g., `if "methods" in cls.__dict__:` or `if meth is None and request.method == "HEAD":`). The remaining logic is straightforward, with good use of helper variables and a moderate level of abstraction. Documentation is helpful, but the awkward conditional style and unnecessary indentation make the code harder to follow than necessary. Overall, readable but with notable structural issues.
Run 1
Code Structure: Responsibilities are logically separated into subclass initialization and request dispatch. Nesting: Generally moderate, but negated conditions with empty pass branches add unnecessary nesting. Clarity of intent: The docstring, descriptive method names, and HEAD fallback comment explain the purpose well; double negation obscures otherwise straightforward checks, and View and http_method_funcs are undefined in this excerpt. Code length: Implementation is reasonably concise, although redundant branches add length; the lengthy docstring provides useful documentation. Action granularity: Statements generally perform one action per line, with only the final handler invocation combining synchronization and execution. Reading flow: Organization is natural, but readers must mentally invert conditions before reaching the meaningful else branches.
Run 2
Code Structure: The class separates method discovery from request dispatch cleanly. Nesting: Mostly shallow, but the inverted conditions with empty pass branches add unnecessary nesting. Clarity of intent: Descriptive method names, documentation, and the HEAD fallback comment explain the purpose well; double negation and abbreviated variables reduce clarity. Code length: The implementation is compact, although pass/else constructs are unnecessarily verbose; the lengthy docstring provides useful context. Action granularity: Statements generally perform one action per line, with only the final handler invocation combining synchronization and execution. Reading flow: Discovery and dispatch follow a logical sequence, but inverted branching interrupts natural reading. Referenced definitions such as View and http_method_funcs are absent from the snippet, slightly limiting self-contained understanding.
Run 3
Code Structure: Responsibilities are logically separated into subclass initialization and request dispatch. Nesting: Mostly moderate, but inverted conditions with empty pass branches add unnecessary nesting. Clarity of intent: Descriptive method names, annotations, a detailed docstring, and the HEAD fallback comment explain the purpose; double negation obscures otherwise simple checks. Code length: Implementation is reasonably concise, although pass/else scaffolding is redundant and the documentation dominates the snippet. Action granularity: Most lines perform one clear action; the final return combines synchronization and invocation but remains understandable. Reading flow: Generally follows a natural sequence, but negative conditions interrupt it. View and http_method_funcs are not defined or imported in the snippet, reducing standalone comprehensibility.