Sample
pyint-62c781e9bddf-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.807 | 0–1; higher is more readable |
| Mi | 0.207 | 0–1; higher is more readable |
| LLOC | 16 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.623 | 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. | 739.345 | −24.398 |
| Source linesThe number of non-empty source lines. | 20 | +8 |
| 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.726 | −7.088 |
Intercept 8.87 + feature contributions = -14.617 (log-odds).
Score = sigmoid(-14.617) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 85.857 | +0.581 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.065 | +0.307 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 21 | +0.293 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 19.782 | −0.133 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 18 | −0.115 |
| 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.905 | +0.027 |
Intercept 0.07 + feature contributions = 1.428 (log-odds).
Score = sigmoid(1.428) = 0.807.
| Score | 0.207 |
|---|
| Score | 16 |
|---|
Run 1
The code is highly readable with clear structure and purpose. It defines a custom exception class with explicit type annotations and a focused initializer that handles request/response attribution cleanly. Nesting is minimal—only one conditional—and the logic flows naturally from parameter extraction to fallback assignment to superclass initialization. Each meaningful action occupies its own line, and the docstring clarifies intent. Variable names are descriptive, and type hints enhance clarity. The only minor deductions are for the slightly dense conditional that combines multiple checks and assignments, which could be marginally clearer if split, and the unused imported exceptions, which add minor noise. Overall, the code is concise, well-organized, and easy to follow.
Run 2
The code is highly readable. Structure is logical, with imports at top and a single class definition. Nesting is minimal: one conditional inside __init__ with a guard clause. Intent is crystal clear — it defines a custom exception class for HTTP requests, attaching request and response objects. Length is concise and appropriate. Action granularity is good, with one meaningful operation per line. Reading flow is natural, from imports to class definition to method logic. The docstring and type hints further improve clarity. Minor deduction for the slightly condensed conditional line and the use of `BaseHTTPError` import which appears unused, but these are negligible in context. Overall, this code is nearly exemplary in readability by Python standards.
Run 3
The code is well-structured with clear class definition and proper type annotations. It uses a single class with one method, maintaining flat nesting and logical organization. The intent is clear: handling ambiguous request exceptions with request/response context. The constructor is concise, extracting keywords and setting attributes before calling super(). Action granularity is good with one logical operation per line. Reading flow is natural, moving from docstring to attribute declarations to initialization logic. Minor deductions: the conditional line is slightly dense, and the response/request relationship logic could benefit from a brief comment explaining why it falls back to response.request. Type annotations add clarity but also length. Overall, this is highly readable code that follows Python best practices.
Run 1
Code Structure: Imports, class documentation, type annotations, and initialization are logically organized, though several imports are unused in this snippet. Nesting: Only one conditional keeps the code nearly flat and easy to scan. Clarity of intent: Descriptive names, annotations, and the initializer docstring clearly explain how request and response are stored; the class docstring is somewhat vague, and referenced types are not defined or imported here. Code length: Concise, with no substantial redundancy. Action granularity: Each statement performs a distinct action, although the conditional combines three checks. Reading flow: Initialization proceeds naturally from extracting the response to assigning attributes, inferring the request, and initializing the superclass. Additional spacing between imports and the class would improve presentation.
Run 2
Code Structure: Imports, exception class, annotations, and initializer are logically organized, though several imports appear unused in this snippet. Nesting: A single conditional keeps nesting shallow. Clarity of intent: Descriptive names, type annotations, and the initializer docstring clearly explain request/response handling; the class docstring is vague, and referenced types are not defined here. Code length: Concise, with little unnecessary code. Action granularity: Statements generally perform one action per line, although extracting and removing keyword arguments combines operations idiomatically. Reading flow: Initialization proceeds naturally from extracting the response to assigning attributes, inferring the request, and initializing the superclass. The compound condition adds minor reading effort.
Run 3
Code Structure: Imports, class documentation, attributes, and initialization are logically organized. Nesting: Only one shallow conditional keeps complexity low. Clarity of intent: Descriptive names and type annotations clearly convey exception initialization, although the class docstring is vague and several referenced types are not defined or imported in the snippet. Code length: Concise overall, but unused imports add minor clutter. Action granularity: Each statement performs a distinct action, with no compressed multi-statement lines. Reading flow: Initialization proceeds naturally from extracting response data to setting request data, applying a fallback, and initializing the superclass. The compound conditional requires slightly more attention but remains readable.