Sample
pyint-35f82b21c5be-I01
Remove comments and docstrings
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.87 | 0–1; higher is more readable |
| Mi | 0.729 | 0–1; higher is more readable |
| LLOC | 58 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.475 | 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. | 4410.481 | −145.546 |
| Source linesThe number of non-empty source lines. | 137 | +54.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.535 | −6.802 |
Intercept 8.87 + feature contributions = -88.678 (log-odds).
Score = sigmoid(-88.678) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 137 | +4.002 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 138 | −3.85 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 136.886 | +1.504 |
| 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 |
| 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. | 77.928 | +0.365 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.075 | +0.213 |
Intercept 0.07 + feature contributions = 1.897 (log-odds).
Score = sigmoid(1.897) = 0.87.
| Score | 0.729 |
|---|
| Score | 58 |
|---|
Run 1
The code is moderately readable. The import section is long but well-organized using parentheses for grouping, though it could be split or reordered for clarity. The class structure is clear with type hints and a straightforward __init__ method. The normalization of None values at the top of __init__ is a good pattern, but the assignment section that follows is repetitive and could be streamlined. The __repr__ and prepare methods are simple and concise. Overall, the code is maintainable but has minor issues with verbosity and repetition, preventing a higher score.
Run 2
The code demonstrates several good practices: logical import organization (standard library, third-party, local), clear class structure with explicit type hints, and a clean __init__ method that normalizes inputs before assignment. The prepare method is concise and delegates appropriately, maintaining single responsibility. Action granularity is consistent, with one action per line throughout. However, the score is reduced by the massive import block spanning 60+ lines, which creates reading friction at the top. The class annotations reference types (RequestHooksMixin, PreparedRequest, RequestsCookieJar, CookieJar) that aren't imported in the shown code, creating ambiguity for readers. The normalization pattern (repeated ternary expressions) is clear but slightly repetitive. Some imports include unused module references (encodings.idna, datetime) that add noise. The docstrings are missing entirely despite complex logic, and the final blank line before the class is unnecessary. Overall, the code is readable but would benefit from import consolidation and documentation.
Run 3
The code is highly readable. It has a clear, logical structure with well-organized imports and a straightforward class definition. It is mostly flat with minimal nesting. The intent is clear: define a Request class with initialization and preparation methods. Code length is concise, and action granularity is appropriate, generally one action per line. Reading flow is natural and easy to follow. Minor points deducted for some redundancy (e.g., defaulting parameters to None then reassigning) and slight verbosity in imports, but overall it is excellent.
Run 1
Code Structure: The class is logically organized into attributes, initialization, representation, and preparation, although the extensive import block distracts from the small implementation. Nesting: Control flow is shallow, with only one simple loop. Clarity of intent: Descriptive method names, type annotations, and explicit keyword arguments make the request-building purpose clear; missing docstrings and dependencies not defined or imported in the snippet reduce self-contained understanding. Code length: The implementation is reasonably concise, but many imports appear unused in the provided code, and attribute declarations repeat information from initialization. Action granularity: Statements generally perform one action per line, making assignments and defaults easy to scan. Reading flow: Initialization proceeds naturally from default normalization through hook registration to attribute assignment, followed by preparation. Excess whitespace and the long import preamble slightly interrupt that flow.
Run 2
Code Structure: The class is logically organized into annotations, initialization, representation, and preparation, though the large import block includes many names unused in this excerpt. Nesting: Control flow is shallow, with only a simple loop. Clarity of intent: Descriptive attributes, method names, and type hints make request construction clear; missing docstrings and externally defined types and classes limit standalone understanding. Code length: The implementation is reasonably concise, but extensive imports, repeated field declarations and assignments, and extra blank lines add visual bulk. Action granularity: Each statement performs one clear action, and multiline calls are easy to scan. Reading flow: Initialization proceeds naturally from default normalization to hook registration and attribute assignment, followed by preparation; excessive whitespace and import overhead slightly interrupt the flow.
Run 3
Code Structure: Imports, attribute declarations, initialization, representation, and preparation are logically grouped, although the large import section includes many names unused in this excerpt. Nesting: Minimal nesting makes control flow easy to follow. Clarity of intent: Descriptive names and type annotations clearly convey request configuration and preparation; however, absent docstrings and undefined dependencies in the excerpt reduce self-contained understanding. Code length: The class is reasonably concise, but extensive imports and repeated attribute forwarding add visual bulk. Action granularity: Statements generally perform one action per line, improving scanability. Reading flow: Methods follow a natural lifecycle from initialization to preparation, with consistent formatting overall; excessive blank space and stray whitespace slightly disrupt the presentation.