Sample
pyint-a814e5451ea1-I01
Remove comments and docstrings
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.788 | 0–1; higher is more readable |
| Mi | 0.533 | 0–1; higher is more readable |
| LLOC | 18 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 8.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15 | 0–20; mean of three runs |
| BTTF | 0.747 | 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. | 658.711 | −21.737 |
| Source linesThe number of non-empty source lines. | 24 | +9.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.638 | −6.957 |
Intercept 8.87 + feature contributions = -10.224 (log-odds).
Score = sigmoid(-10.224) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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. | 59 | +1.166 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| 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.314 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 25 | +0.151 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 24 | +0.093 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 23.833 | −0.077 |
Intercept 0.07 + feature contributions = 1.311 (log-odds).
Score = sigmoid(1.311) = 0.788.
| Score | 0.533 |
|---|
| Score | 18 |
|---|
Run 1
The code is minimal and generally readable, but it suffers from a few clarity and completeness issues. The structure is straightforward: imports, a class, and a constructor with two methods. Nesting is flat, and each action is on its own line, which is good. However, the `getheaders` method has a clear bug: it calls `self._headers.getheaders(name)` but does not return the result, making its intent ambiguous and likely incorrect. The `_headers` attribute is only type-hinted as `Any`, which reduces clarity. The method `info()` returning `self._headers` is simple but lacks explanation of the expected header format. The code is concise but overly sparse—some methods are empty, and the class-level docstring is absent. The reading flow is natural, but the missing return statement and lack of documentation hurt overall readability. With clearer type hints, a docstring, and fixing the return bug, this would be much more readable.
Run 2
The code is poorly structured and contains multiple critical flaws. It begins with many unused imports, suggesting a copy-paste or unmaintained file. The MockResponse class is incomplete and incorrectly indented, with blank lines inside class and method bodies. The getheaders method calls self._headers.getheaders(name) but does not return the result, making it functionally broken. The code lacks docstrings, proper formatting, and consistent spacing. The reading flow is disrupted by disorganized blank lines and unclear intent. Action granularity is acceptable, but nesting is absent. Overall, the file appears to be an unfinished sketch, lacking clarity of purpose and proper structure.
Run 3
The code has some positive structural elements like clear imports, type hints, and a logical class definition with an initializer. However, it fails significantly on readability criteria. The most critical issue is in the getheaders method, which is missing a return statement, rendering it functionally broken and creating ambiguous intent — this alone substantially lowers its readability score. Additionally, there are excessive blank lines within the class that disrupt the natural reading flow. Several imports appear unused (calendar, copy, time, CookieJar, CookiePolicy, Iterator, MutableMapping, TYPE_CHECKING, TypeVar, overload, etc.), adding noise and making the code's actual dependencies unclear. The action granularity is adequate, but the overall code length is unnecessarily long due to unused imports and formatting issues. The nesting is flat, which is good, but the clarity of intent is severely compromised by the broken method and unexplained imports. Though the code structure is basically logical and flat, the missing return statement and clutter create ambiguity about the code's true purpose.
Run 1
Code Structure: The class is logically organized, but numerous unused imports and the separately placed threading import add clutter. Nesting: Methods are flat and easy to follow. Clarity of intent: MockResponse and its method names suggest a response-header adapter, although Any annotations provide little detail. The missing return in getheaders makes its intended behavior unclear. Code length: The implementation is concise, but excessive imports and empty lines unnecessarily expand the snippet. Action granularity: Each statement performs a single action, with no compressed expressions. Reading flow: Constructor followed by access methods reads naturally, but inconsistent spacing and import organization interrupt the flow.
Run 2
Code Structure: The class and methods are logically organized, but numerous unused imports and inconsistent import grouping add clutter. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: MockResponse and its methods suggest a response-header adapter, although Any annotations provide little detail and getheaders lacks a return statement, making its intended behavior unclear. Code length: The implementation is concise, but excessive blank lines and unused imports unnecessarily lengthen the snippet. Action granularity: Each statement performs one action, with no compressed multi-action lines. Reading flow: Method order is natural, but whitespace gaps and the misplaced threading import interrupt the flow.
Run 3
Code Structure: The class and its methods are logically organized, but numerous unused imports and inconsistent import grouping add clutter. Nesting: The code is flat, with no complex nesting. Clarity of intent: MockResponse and its methods suggest a response-header wrapper, though broad Any annotations provide little guidance, and getheaders discards its result, making its intended behavior unclear. Code length: The implementation is concise, but excessive blank lines and unused imports unnecessarily expand it. Action granularity: Each statement performs a single action. Reading flow: Methods follow a natural order, but irregular spacing and threading appearing after local imports disrupt the flow.