Sample
pyint-76c4345259ca-I01
Remove comments and docstrings
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.04 | 0–1; higher is more readable |
| Mi | 0.64 | 0–1; higher is more readable |
| LLOC | 129 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 13.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14 | 0–20; mean of three runs |
| BTTF | 0.429 | 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. | 8909.906 | −294.027 |
| Source linesThe number of non-empty source lines. | 299 | +119.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.166 | −6.25 |
Intercept 8.87 + feature contributions = -171.806 (log-odds).
Score = sigmoid(-171.806) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 299 | +9.605 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 300 | −9.586 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 299 | −6.44 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 298.91 | +3.768 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.069 | +0.269 |
| 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. | 87.957 | −0.06 |
Intercept 0.07 + feature contributions = -3.178 (log-odds).
Score = sigmoid(-3.178) = 0.04.
| Score | 0.64 |
|---|
| Score | 129 |
|---|
Run 1
The code demonstrates generally good structure with logical organization into focused methods, mostly flat nesting, and clear intent through descriptive method names. However, several issues impact readability: excessive blank lines with empty comment placeholders (removed documentation strings) disrupt flow, type hints reference undefined '_t' namespace, and long methods like 'resolve_redirects' pack many operations together. While individual operations are well-separated, the redirect loop's complexity is somewhat hidden by inline comments that substitute for proper documentation. The mixed use of single-letter variables ('req', 'resp') versus descriptive names creates inconsistency. Action granularity is appropriate with one operation per line, and reading flow follows a natural sequence, but the missing docstrings and scattered empty comments suggest incomplete documentation that would otherwise clarify intent. The code would benefit from extracting the redirect loop body into helper methods and restoring proper docstrings.
Run 2
The code has clear intent and logical structure, but suffers from readability issues. Many lines appear as blank or whitespace-only, especially in get_redirect_target and should_strip_auth, which disrupts the reading flow. There are excessive trailing spaces after lines like `hist: list[Response] = [] ` and `yield req `, suggesting missing comments or accidental formatting. Nesting is mostly flat, which is good, and action granularity is reasonable. However, some methods (resolve_redirects) are long and carry many responsibilities, making them harder to follow. Type hints and descriptive method names help clarity, but the incomplete or absent comments where whitespace remains indicate unclear documentation. The import block is clean, but the overall formatting inconsistency lowers readability.
Run 3
The code is generally well-structured with clear method separation and logical organization. Most methods have single responsibility and use descriptive names. The nesting depth is moderate but acceptable. Comments explain non-obvious logic, particularly around redirect handling and auth stripping. However, there are several issues: excessive blank lines with placeholder comments (e.g., 11 consecutive empty comment lines in get_redirect_target), inconsistent whitespace in imports and type hints (_t.TimeoutType, _t.VerifyType, _t.CertType are undefined - likely missing import), and some long methods like resolve_redirects that handle many concerns. The reading flow is mostly natural but the method could benefit from extracting helper functions. Minor inconsistency exists with inline comments and spacing. Overall, the code follows Python conventions well and maintains reasonable clarity despite some complexity inherent to redirect handling.
Run 1
Code Structure: Related redirect operations are organized into a coherent mixin with focused helper methods, although resolve_redirects handles many responsibilities. Nesting: Generally moderate, with straightforward conditionals; the redirect loop contains several nested branches but remains manageable. Clarity of intent: Descriptive method names, variables, and type annotations communicate purpose, but undocumented HTTP edge cases, abbreviated names, and unresolved annotation references such as _t reduce clarity. Code length: Mostly justified by redirect complexity, but excessive blank lines, unused imports, and the lengthy central method add unnecessary bulk. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: Redirect processing follows a logical sequence, but large whitespace gaps and missing explanatory comments interrupt continuity and obscure why certain transformations are necessary.
Run 2
Code Structure: The mixin groups related redirect behavior logically, with focused helpers, but resolve_redirects combines many responsibilities. Nesting: Mostly shallow conditionals and early returns; the redirect loop adds moderate nesting without becoming tangled. Clarity of intent: Descriptive method names and type annotations help, but undocumented HTTP edge cases, missing context for _t and CookieJar, and inconsistent generator annotations obscure details. Code length: Helpers are reasonably concise, while resolve_redirects is long and excessive blank lines inflate the presentation. Action granularity: Statements generally perform one action per line, making changes easy to track. Reading flow: Redirect processing follows a coherent sequence, but whitespace gaps and the absence of explanatory comments interrupt reading and leave subtle encoding, authentication, and body-rewinding decisions unexplained.
Run 3
Code Structure: The redirect mixin is logically organized into focused helpers, although resolve_redirects combines many responsibilities. Nesting: Mostly shallow conditionals and early returns; the redirect loop adds moderate nesting without becoming tangled. Clarity of intent: Descriptive method and variable names convey purpose, but missing explanatory comments obscure HTTP edge cases, and unresolved type names such as _t and CookieJar distract readers. Code length: Most helpers are concise, but resolve_redirects is lengthy and excessive blank lines unnecessarily expand the code. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: Redirect processing follows a coherent sequence, supported by helper methods, but irregular whitespace, unused imports, and undocumented state changes interrupt the flow.