Sample
pyint-def6fe16c343-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.391 | 0–1; higher is more readable |
| Mi | 0.377 | 0–1; higher is more readable |
| LLOC | 51 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 13.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.558 | 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. | 2980.469 | −98.355 |
| Source linesThe number of non-empty source lines. | 95 | +38 |
| 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.486 | −6.729 |
Intercept 8.87 + feature contributions = -58.214 (log-odds).
Score = sigmoid(-58.214) = 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. | 96 | −2.363 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 81 | +2.065 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 81 | −1.438 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 106.927 | +0.921 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 94.817 | +0.916 |
| 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.958 | −0.907 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.067 | +0.296 |
Intercept 0.07 + feature contributions = -0.442 (log-odds).
Score = sigmoid(-0.442) = 0.391.
| Score | 0.377 |
|---|
| Score | 51 |
|---|
Run 1
The code is generally well-structured and readable, with clear class and method purposes. Import organization is logical, and type hints improve intent clarity. Each method performs a single action, contributing to good action granularity. The `get_full_url` method contains an awkward and confusing double-negative condition (`if not (not self._r.headers.get("Host"))`) with an empty `pass` block, which significantly hampers clarity. Additionally, the comment inside `get_full_url` slightly disrupts natural reading flow. While nesting is minimal and the code is concise, that one method's logic is unnecessarily convoluted, affecting overall readability. The class is easy to follow otherwise.
Run 2
The code structure is mostly logical, with clear separation of methods and a coherent class purpose, but it is tangled at points. The `get_full_url` method contains an unnecessarily confusing `if not (not ...)` condition with a `pass` branch, which obscures intent and hurts readability. Nesting is mostly flat, which is good, but that one conditional adds avoidable complexity. Clarity of intent is partly undermined by comments that are either misleading or incomplete (e.g., the comment in `get_full_url` is hard to follow). Code length is moderate and not overly verbose. Action granularity is mostly one action per line, though some lines combine multiple operations (e.g., reading and writing headers in `get_header`). Reading flow is generally natural, but the awkward conditional and redundant property methods `unverifiable`, `origin_req_host`, and `host` create unnecessary noise. Overall, it is readable but would benefit from simplifying conditionals and removing redundant wrappers.
Run 3
The code is generally readable but has some confusing parts. It has a clear class structure with logical method separation, but the get_full_url() method contains an inverted, confusing conditional (`if not (not self._r.headers.get("Host")): pass else: return`), which creates avoidable nesting and obscures intent. The empty if branch with a pass is a significant clarity issue. There are minor type hint inconsistencies (e.g., PreparedRequest is not imported or defined). The docstring is helpful, and most methods are concise and single-purpose. Some methods feel redundant or unnecessary, such as forwarding properties. Overall, the organization is good, but the conditional logic and incomplete typing reduce readability.
Run 1
Code Structure: The class is logically organized into small interface methods, although imports are inconsistently grouped and include unused names. Nesting: Generally flat, with only a shallow conditional. Clarity of intent: The class docstring, descriptive method names, and type annotations clearly explain the adapter’s purpose. However, the double negation and empty pass branch in get_full_url obscure a simple condition, and its comment incorrectly refers to a response. Code length: Mostly concise, but the conditional adds unnecessary lines; some thin wrappers are justified by the required interface. Action granularity: Statements generally perform one action per line, and the URL reconstruction is formatted clearly. Reading flow: Mostly natural and easy to scan, interrupted chiefly by the awkward conditional, misplaced threading import, and long get_header line.
Run 2
Code Structure: A cohesive adapter class with logically separated methods, although import ordering is inconsistent and several imports appear unused. Nesting: Mostly flat and easy to follow; get_full_url adds an unnecessary if/pass/else branch. Clarity of intent: The class docstring, descriptive method names, and type annotations explain the purpose well. However, the double negation in the Host check obscures a simple condition, and PreparedRequest is not defined or imported in the snippet. Code length: Generally concise, but redundant control flow and some repetitive comments add avoidable length. Action granularity: Statements consistently perform one action per line, with readable formatting for URL reconstruction. Reading flow: Methods progress naturally from request metadata to header handling and convenience properties; the awkward Host conditional and misplaced threading import interrupt otherwise smooth reading.
Run 3
Code Structure: The class is logically organized around adapting a request to a cookie-handling interface, although unused imports and the misplaced threading import add clutter. Nesting: Methods are mostly flat, with minimal branching. Clarity of intent: Descriptive method names, type annotations, and a detailed class docstring explain the purpose well; however, the double-negative condition and empty pass branch in get_full_url obscure a straightforward Host-header check. Code length: Most methods are concise, but redundant branching, unused imports, and some obvious comments unnecessarily expand the code. Action granularity: Statements generally perform one action per line; the nested dictionary lookup in get_header is compact but slightly harder to scan. Reading flow: Related methods and properties follow a natural sequence, though import ordering, the awkward conditional, and the unexplained PreparedRequest annotation interrupt otherwise clear reading.