Sample
pyint-911a9744e2cf-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.095 | 0–1; higher is more readable |
| Mi | 0.411 | 0–1; higher is more readable |
| LLOC | 160 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 11.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14.33 | 0–20; mean of three runs |
| BTTF | 0.317 | 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. | 9921.788 | −327.419 |
| Source linesThe number of non-empty source lines. | 224 | +89.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.496 | −6.743 |
Intercept 8.87 + feature contributions = -235.692 (log-odds).
Score = sigmoid(-235.692) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 225 | −6.93 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 199 | +6.146 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 199 | −4.146 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 223.854 | +2.719 |
| 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. | 121.987 | −1.502 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 121.982 | +1.164 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.074 | +0.222 |
Intercept 0.07 + feature contributions = -2.257 (log-odds).
Score = sigmoid(-2.257) = 0.095.
| Score | 0.411 |
|---|
| Score | 160 |
|---|
Run 1
The code has several readability challenges. The class structure is somewhat organized, but methods like build_digest_header are long and contain deeply nested conditional logic. While the action granularity is generally one operation per line, some lines are overly long with awkward formatting (e.g., the `base = (` multi-line string, and the broken `_digest_auth = self.build_digest_header(` call). The intent is partially clear from comments and method names like handle_401 and handle_redirect, but complex digest logic lacks explanatory comments for branches. Type hints are helpful but contribute to clutter in some places. The reading flow is interrupted by inconsistent spacing, multi-line function calls, and abrupt method transitions without blank lines. Nesting depth is moderate but still increases cognitive load. Overall, the code needs structural refactoring, more consistent style, and extraction of complex logic into smaller functions to improve readability.
Run 2
The code has reasonable structure but suffers from inconsistent formatting, overly long methods, and some deeply nested logic. The build_digest_header method is particularly long with repetitive if/elif blocks, making it hard to follow. There are awkward line breaks, misaligned indentation, and spacing issues throughout. While naming is generally clear and intent is mostly understandable, the digest authentication logic is complex and the implementation doesn't do enough to break it down. The handle_401 and __call__ methods have moderate nesting but some lines combine multiple operations. Action granularity is occasionally violated. The reading flow is disrupted by formatting inconsistencies and the nested functions. Some comments are helpful, but they're not enough to compensate for the overall readability issues.
Run 3
The code is moderately readable but has several issues. The class has clear purpose and type hints, but method definitions lack spacing between them, hurting visual separation. Nested functions inside build_digest_header create multiple duplication (md5_utf8, sha_utf8, etc.) and make the logic harder to follow. The base string construction has awkward formatting with excessive whitespace and misaligned parentheses. Some lines are overlong (f-strings with many interpolations), reducing scannability. The action granularity is mixed: most lines do one thing, but some combine multiple operations (e.g., s += nonce.encode('utf-8')). The reading flow is disrupted by formatting inconsistencies and the `_thread_local` access pattern repeating frequently without abstraction. The use of walrus operators in conditionals adds cognitive load. Overall, the code is maintainable by someone familiar with HTTP digest auth but not immediately clear to a general reader. Deduplicating hash function definitions and improving spacing/line breaks would raise readability significantly.
Run 1
Code Structure: Responsibilities are sensibly separated into initialization, digest construction, response handling, and request hooks, though digest construction does too much. Nesting: Mostly shallow, with moderate nesting in algorithm selection and authentication retry handling. Clarity of intent: Descriptive method names, type hints, and explanatory comments help; terse protocol variables, stale comments, and implicit thread-local state make some details harder to follow. Code length: Generally justified by the protocol, but repeated hashing helpers and unused imports add clutter. Action granularity: Most lines perform one action; assignments inside conditions and the standalone r.content access require extra interpretation. Reading flow: Processing follows a logical sequence, but inconsistent spacing, missing blank lines between methods, and awkwardly formatted calls interrupt scanning.
Run 2
Code Structure: Methods separate initialization, digest generation, response handling, and request preparation logically, although digest generation combines several responsibilities. Nesting: Mostly shallow, with manageable nested conditionals and local hash functions. Clarity of intent: Descriptive method names, annotations, and protocol comments help; abbreviated variables such as s, KD, and _r, misleading comments, and unexplained state obscure details. Code length: Reasonable for the functionality, but repeated hash wrappers, unused imports, and placeholder logic add clutter. Action granularity: Generally one action per line; assignment expressions slightly increase cognitive load but remain localized. Reading flow: Authentication steps follow a coherent sequence, but inconsistent spacing, missing blank lines between methods, awkward line wrapping, and frequent thread-local accesses interrupt scanning.
Run 3
Code Structure: Methods logically separate initialization, digest construction, response handling, and request preparation, but digest construction combines several responsibilities. Nesting: Mostly shallow, with early returns limiting depth; nested hash functions and authentication branches add complexity. Clarity of intent: Descriptive method names, type hints, and explanatory comments help, but abbreviated variables, implicit thread-local state, and outdated comments obscure details. Code length: Repeated hash wrappers and lengthy digest construction introduce avoidable verbosity. Action granularity: Generally one action per line; inline overload declarations and assignment expressions slightly compress operations without substantially impairing comprehension. Reading flow: Authentication steps follow a sensible sequence, but inconsistent blank lines, awkward spacing in multiline expressions, and sparse method separation interrupt scanning. Overall, readable to someone familiar with HTTP digest authentication, but formatting cleanup, clearer names, and helper extraction would improve accessibility.