Sample
pyint-e61d471b6724-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.856 | 0–1; higher is more readable |
| Mi | 0.523 | 0–1; higher is more readable |
| LLOC | 20 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.753 | 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. | 676.419 | −22.322 |
| Source linesThe number of non-empty source lines. | 29 | +11.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.699 | −7.048 |
Intercept 8.87 + feature contributions = -8.9 (log-odds).
Score = sigmoid(-8.9) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.041 | +0.539 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 76.4 | +0.428 |
| 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. | 78.967 | +0.321 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 23 | +0.058 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 30 | −0.026 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 28.738 | −0.008 |
Intercept 0.07 + feature contributions = 1.78 (log-odds).
Score = sigmoid(1.78) = 0.856.
| Score | 0.523 |
|---|
| Score | 20 |
|---|
Run 1
The code is generally clear and well-structured. It has a logical organization with imports grouped at the top, a class definition, and a docstring explaining a non-obvious design choice. Nesting is minimal, and the reading flow is natural. The class has a single responsibility and the methods are short. However, the `getheaders` method appears to be missing a `return` statement, which reduces clarity of intent. Additionally, the `MockResponse` docstring contains informal language ('...what?') that, while explanatory, may not fit all style guidelines. Overall, readability is good but could be improved with a return value and slightly more formal documentation.
Run 2
The code has a clear structure with a single class and docstrings explaining intent, which helps readability. However, the constructor is straightforward while the getheaders method fails to return the result, which is ambiguous and could confuse readers. Imports are reasonably organized, though some appear unused or excessive for the snippet. The nesting is flat and action granularity is good, with one action per line inside methods. Reading flow is mostly natural, but the missing return statement breaks clarity. Compared to tangled code, this is quite readable, but minor flaws like the unused imports and the silent no-op method reduce the score.
Run 3
The code is reasonably readable with a clear purpose (MockResponse wrapper) and mostly flat structure. Imports are grouped logically, and type hints suggest modern Python. The class has a concise docstring and two simple methods with clear names. However, there are minor issues: the getheaders method is missing a return statement, making its intent slightly ambiguous. The docstring is somewhat conversational ('...what?') which reduces professionalism. Import order is slightly disorganized (threading appears after from-imports). Overall, the code is compact, uses one action per line, and reads naturally, but small clarity and correctness issues prevent a higher score.
Run 1
1. Code Structure: The small wrapper class is logically organized, though numerous unused imports and the misplaced threading import add clutter. 2. Nesting: Methods are flat and easy to follow, with no nested control flow. 3. Clarity of intent: Class and constructor docstrings explain the compatibility purpose, and names are descriptive. However, getheaders calls the underlying method without returning its result, making its intended behavior unclear. 4. Code length: The class is concise, but the import block is disproportionately large for the shown functionality. 5. Action granularity: Each executable line performs a single action. 6. Reading flow: Methods progress naturally from initialization to accessors; import ordering and limited spacing between top-level elements slightly weaken the flow.
Run 2
Code Structure: The wrapper class is logically organized, but numerous unused imports and the late threading import add clutter. Nesting: Methods are flat, with no unnecessary nesting. Clarity of intent: The class docstring explains its compatibility purpose, and method names are recognizable; however, the informal wording and broad Any annotations reduce precision. The missing return in getheaders makes its intended behavior less clear. Code length: The class is concise, although the imports are excessive for this snippet. Action granularity: Each statement performs a single action. Reading flow: Constructor followed by accessor methods creates a natural progression, but inconsistent spacing between imports, the class, and its docstring slightly weakens presentation.
Run 3
Code Structure: The small wrapper class is logically organized, although imports are poorly grouped and many appear unused in this snippet. Nesting: Methods are flat, with no unnecessary nesting. Clarity of intent: Descriptive names, type annotations, and docstrings explain the adapter's purpose, though Any provides limited type information and getheaders ambiguously discards the underlying result. Code length: The implementation is concise, but the extensive imports add clutter relative to the class's size. Action granularity: Each statement performs one action, making individual lines easy to follow. Reading flow: Initialization followed by accessor methods is natural; inconsistent import placement, limited spacing between sections, and the conversational docstring slightly reduce polish.