Sample
pyint-1eccfb5ca06a-I05
Rewrite eligible decimal integer literals in hexadecimal notation
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.401 | 0–1; higher is more readable |
| Mi | 0.372 | 0–1; higher is more readable |
| LLOC | 50 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.535 | 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. | 2928.092 | −96.627 |
| Source linesThe number of non-empty source lines. | 93 | +37.2 |
| 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.499 | −6.749 |
Intercept 8.87 + feature contributions = -57.306 (log-odds).
Score = sigmoid(-57.306) = 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. | 94 | −2.292 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 79 | +1.995 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 79 | −1.392 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 107.989 | +0.938 |
| 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. | 107.947 | −0.907 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 92.798 | +0.887 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.066 | +0.298 |
Intercept 0.07 + feature contributions = -0.402 (log-odds).
Score = sigmoid(-0.402) = 0.401.
| Score | 0.372 |
|---|
| Score | 50 |
|---|
Run 1
The code is highly readable with clear structure and organization. It wraps a requests.PreparedRequest to mimic urllib2.Request, and each method has a singular, well-defined purpose. Nesting is minimal: the only conditional is in get_full_url, and the logic is broken into understandable steps. Clarity of intent is strong with docstrings and comments explaining the 'why' behind non-obvious behavior. Code length is concise and avoids redundancy. Action granularity is good: generally one operation per line, though the return in get_header is dense but acceptable. Reading flow is natural: properties and methods are logically grouped, and type hints improve comprehension. Minor deductions: the 'type' class-level annotation before __init__ is slightly out of place, get_full_url's reconstruction could be split for even clarity, and the NotImplementedError method is verbose but justified. Overall, a well-structured, maintainable snippet.
Run 2
The code is well-structured and follows clear organizational patterns. It uses a single class with a clear purpose: wrapping a PreparedRequest to mimic urllib2.Request for cookiejar compatibility. Nesting is minimal — the only conditional in get_full_url is flat and straightforward. Intent is clearly communicated through the class docstring and method names, though type hints could be more consistent (e.g., PreparedRequest missing import). The code is concise without being terse, with each method focused on a single responsibility. Action granularity is mostly one action per line, though the return statement in get_header packs several operations. Reading flow is natural, with methods ordered logically from simple getters to more complex URL reconstruction. Minor issues include a type comment in get_header and the assertion pattern in __init__, which could be more explicit. Overall, the code demonstrates good readability with clear separation of concerns and minimal complexity.
Run 3
The code has some positive structural elements like clear class naming, type hints, and separation of methods, but suffers from several readability issues. The main problems are unnecessary imports (`calendar`, `copy`, `time`, `threading`, `MutableMapping`, etc.) that add noise. There are also missing dependencies - `PreparedRequest` is referenced but not imported, making the code incomplete. The nesting in `get_full_url()` is acceptable, but the overall intent is unclear without seeing the broader context. Action granularity is mostly good with one operation per line. However, the `get_header` method has a type ignore comment that suggests potential issues, and the `add_header` method raising NotImplementedError creates an inconsistent interface. The class seems to be a compatibility wrapper, but the complexity of URL reconstruction in `get_full_url()` could benefit from extraction. Import ordering is inconsistent. While methods are reasonably named and focused, the incomplete imports and dead imports significantly impact readability.
Run 1
Code Structure: The wrapper class is logically organized into initialization, request accessors, header operations, and compatibility properties, though imports are not consistently grouped and several appear unused. Nesting: Control flow is flat, with one simple conditional and an early return. Clarity of intent: The class docstring, descriptive method names, and type annotations clearly explain the adapter's purpose; the abbreviated field `_r` and undefined-in-snippet `PreparedRequest` slightly reduce clarity. Code length: Methods are concise, although compatibility forwarding methods and some repetitive comments add length. Action granularity: Statements generally perform one action per line, and URL reconstruction is formatted clearly. Reading flow: Methods follow a natural progression, with consistent spacing and formatting. Minor distractions include the trailing type-ignore comment and the misplaced threading import.
Run 2
Code Structure: The class is logically organized into request accessors, header operations, and compatibility properties, though several imports appear unused and threading is separated from other standard-library imports. Nesting: Control flow is shallow, with a simple conditional and early return. Clarity of intent: Descriptive method names, type annotations, and the class docstring explain the adapter's purpose well; the abbreviated _r attribute and misleading reference to a response URL slightly reduce clarity. Code length: Methods are concise, although compatibility wrappers and the lengthy docstring add some reading overhead. Action granularity: Statements generally perform one action per line, and URL reconstruction is formatted clearly. Reading flow: The progression from initialization through request metadata to headers and properties is natural, with minor distractions from import clutter and a long get_header expression.
Run 3
Code Structure: A cohesive adapter class organizes request access and header handling into focused methods, though imports appear cluttered and include unused names. Nesting: Control flow is shallow, with a simple conditional and early return. Clarity of intent: Descriptive method names, type annotations, and a detailed class docstring explain the interface and purpose well; the abbreviated attribute _r and externally defined PreparedRequest slightly reduce clarity. Code length: Most methods are concise, although compatibility wrappers and explanatory comments add some repetition. Action granularity: Statements generally perform one action per line; the nested dictionary lookups in get_header are slightly denser. Reading flow: Methods progress naturally from request metadata to headers and compatibility properties, with consistent formatting. Minor distractions include threading placed after local imports and a comment referring to a response URL despite wrapping a request.