Sample
pyint-08be3d224a33-I11
Split eligible integer literals into pairs of short-named intermediate variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.005 | 0–1; higher is more readable |
| Mi | 0.561 | 0–1; higher is more readable |
| LLOC | 194 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.355 | 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. | 13099.983 | −432.299 |
| Source linesThe number of non-empty source lines. | 424 | +169.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.463 | −6.695 |
Intercept 8.87 + feature contributions = -260.524 (log-odds).
Score = sigmoid(-260.524) = 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. | 425 | −14.012 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 335 | +10.85 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 335 | −7.266 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 423.957 | +5.516 |
| 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. | 139.981 | −2.264 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 139.984 | +1.454 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.05 | +0.454 |
Intercept 0.07 + feature contributions = -5.198 (log-odds).
Score = sigmoid(-5.198) = 0.005.
| Score | 0.561 |
|---|
| Score | 194 |
|---|
Run 1
The code is well-structured with clear class organization, logical method separation, and comprehensive type hints. Each method handles a specific preparation step (method, URL, headers, body, auth, cookies, hooks), making the flow intuitive. The docstrings are informative and include usage examples. However, there are nesting issues in prepare_url and prepare_body where conditionals reach 3-4 levels deep (e.g., the try/except blocks, nested if statements). The action granularity is mixed - some methods like prepare_auth break operations into unnecessary intermediate variables (a=1, b=1) while others like prepare_url handle multiple concerns (validation, IDNA encoding, reconstruction) in a single method, resulting in methods exceeding 50 lines. The inline comments are mostly helpful, though some are overly verbose. Type annotations and explicit imports contribute positively to readability, but the heavy use of cast() and ignore comments slightly obscures intent. Overall, the code is maintainable and readable, with room for simplification in larger methods.
Run 2
The code is generally well-structured with clear method separation, strong type hints, and helpful comments. The `prepare` method reads naturally as a sequence of preparation steps. However, `prepare_body` and `prepare_url` are quite long and contain multiple conditional branches, increasing cognitive load. There are some confusing artifacts like `a = 1; b = 1` in `prepare_auth`, which obscures intent. The heavy use of type-ignoring comments and backwards-compatibility shims also reduces clarity. Overall, readable but with sections that could benefit from extraction into smaller helper methods.
Run 3
The code is highly readable with logical organization, clear intent, and good structure. The class is well-documented with docstrings explaining behavior, parameters, and side effects. Methods are appropriately granular, each handling a specific aspect of request preparation (method, URL, headers, body, auth, cookies, hooks). Comments clarify non-obvious logic and important sequencing constraints. Type hints are comprehensive and improve clarity. Nesting depth is reasonable—the deepest logic appears in prepare_body with several conditional branches, but it remains manageable. The imports are extensive but organized. Minor readability improvements could include extracting complex conditionals into named variables and reducing some longer methods, but overall the code flows naturally and follows established Python conventions.
Run 1
Code Structure: Well-organized class with focused preparation methods and a clear orchestration entry point; prepare_body handles enough cases to merit further decomposition. Nesting: Mostly shallow, but body preparation contains several nested conditionals and exception handlers. Clarity of intent: Descriptive method names, annotations, docstrings, and explanatory comments communicate purpose well. However, arbitrary a and b variables for checking a two-element tuple, vague names such as p and r, and the irrelevant 'Nottin’ on you' comment reduce clarity. Code length: Generally justified by HTTP edge cases, though extensive imports, redundant comments, and typing workarounds add visual noise. Action granularity: Consistently uses one operation per line, making state changes easy to identify. Reading flow: The preparation pipeline and sequential validation read naturally; complex body branching, long inline type-ignore comments, and dependencies not defined in the excerpt occasionally interrupt comprehension.
Run 2
Code Structure: Well organized into focused preparation methods, with a clear orchestration method separating responsibilities. Nesting: Mostly shallow, but prepare_body has several nested branches and exception handlers that increase cognitive load. Clarity of intent: Descriptive method names, type annotations, and explanatory documentation make the purpose clear. However, arbitrary a and b variables for checking tuple length, vague names such as p and r, and an irrelevant comment reduce clarity. Code length: Generally justified by HTTP edge cases, though verbose comments, long type-ignore annotations, and some redundant branching add clutter. Action granularity: Statements generally perform one action per line; tuple unpacking remains understandable. Reading flow: Preparation follows a natural sequence, with comments explaining ordering dependencies. Longer URL and body methods interrupt the otherwise smooth flow, and references to mixins and types absent from the snippet require external context.
Run 3
Code Structure: Well organized into focused preparation methods, with a central method clearly coordinating their order. Nesting: Mostly shallow, but prepare_body has several nested branches that increase cognitive load. Clarity of intent: Descriptive method names, type annotations, and documentation explain most behavior; arbitrary a and b variables for checking tuple length, a cryptic comment, and frequent casts/type-ignore annotations introduce distractions. Code length: Generally justified by HTTP edge cases, though lengthy comments, imports, and some redundant branching reduce concision. Action granularity: Consistently uses one operation per line, making state changes easy to track. Reading flow: Preparation follows a natural sequence, with useful explanations of ordering constraints; long body and URL routines, annotation clutter, and dependencies not defined in the excerpt occasionally interrupt the flow.