Sample
pyint-a2b2051a3815-I08
Select one of ten high-readability unrelated code templates per class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.394 | 0–1; higher is more readable |
| Mi | 0.372 | 0–1; higher is more readable |
| LLOC | 53 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 13.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.67 | 0–20; mean of three runs |
| BTTF | 0.499 | 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. | 3043.898 | −100.449 |
| Source linesThe number of non-empty source lines. | 96 | +38.4 |
| 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.493 | −6.739 |
Intercept 8.87 + feature contributions = -59.917 (log-odds).
Score = sigmoid(-59.917) = 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. | 97 | −2.398 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 82 | +2.099 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 82 | −1.461 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 107.959 | +0.937 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 95.807 | +0.929 |
| 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.969 | −0.908 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.066 | +0.301 |
Intercept 0.07 + feature contributions = -0.43 (log-odds).
Score = sigmoid(-0.43) = 0.394.
| Score | 0.372 |
|---|
| Score | 53 |
|---|
Run 1
The code has good documentation and fairly clear intent, but several issues hurt readability. The get_header method is overloaded and confusing: it retrieves headers from two separate dictionaries without a clear explanation. The get_new_headers method contains a pointless loop that decrements a counter without any effect. Import order is scattered, and there's unused or unclear importing (threading, TYPE_CHECKING, MutableMapping, coding). The MockRequest mock is readable but the comment style is very verbose in some places and too brief in others. Type hints are present and help. The overall structure is passable but not excellent; the class is well-contained but the methods feel uneven, with some very clear and others obscure. The dead code and odd import length undermine readability, leaving the reader to wonder if they are missing something important.
Run 2
The code is generally well-structured and readable, with clear class and method definitions. Naming is descriptive and intent is mostly clear. However, there is a suspicious `get_new_headers` method containing a meaningless `while` loop that does nothing, which hurts clarity and suggests dead or debug code. Some methods are trivial wrappers that could be simplified, but they improve compatibility. The reading flow is natural, and nesting is shallow. Import organization is slightly cluttered but acceptable. Overall, it's readable but not exemplary due to the confusing loop and minor verbosity.
Run 3
The code is well-structured with clear class and method separation, consistent docstrings, and type hints that enhance clarity. Most methods follow a flat, readable flow with minimal nesting, and each action is generally on its own line. The exception is the leftover 'while remaining_steps > 0' loop in get_new_headers, which is dead code and briefly disrupts readability. Naming is descriptive, and the class purpose is explicitly documented. Overall, it is highly readable with only minor issues.
Run 1
Code Structure: The class is logically organized into request-interface methods and properties, though imports are poorly grouped and several appear unused. Nesting: Methods remain flat, with only a simple conditional and loop. Clarity of intent: Descriptive method names, type annotations, and the class docstring explain the adapter well; however, the pointless countdown in get_new_headers obscures intent, and PreparedRequest has no visible import. Code length: Most methods are concise, but the countdown and some repetitive comments add unnecessary length. Action granularity: Statements generally perform one action per line; the nested dictionary lookups in get_header are slightly dense. Reading flow: Methods follow a coherent progression, and formatting is consistent, but the misplaced threading import and unexplained countdown interrupt otherwise natural reading.
Run 2
Code Structure: The class is logically organized into initialization, request-interface methods, header handling, and properties, though import ordering is inconsistent and several imports are unused. Nesting: Control flow is shallow, with simple conditionals and one loop. Clarity of intent: Descriptive method names, type annotations, and a detailed class docstring explain the adapter's purpose; however, the pointless countdown in get_new_headers obscures an otherwise straightforward accessor. Code length: Most methods are concise, but the countdown adds unnecessary lines and the imports add clutter. Action granularity: Statements generally perform one action per line; the nested dictionary lookup in get_header is slightly denser but still understandable. Reading flow: Methods and property wrappers follow a natural progression, with whitespace and comments aiding scanning. The unexplained loop and minor inconsistencies interrupt an otherwise readable implementation.
Run 3
Code Structure: The class logically groups request-adapter methods and properties, though imports are inconsistently organized and several appear unused. Nesting: Control flow is shallow, with an early return keeping URL handling flat. Clarity of intent: Descriptive method names, type annotations, and the class docstring explain the adapter well; however, the unexplained countdown in get_new_headers obscures an otherwise simple getter, and the comment referring to a response URL is misleading. Code length: Most methods are concise, but the countdown adds unnecessary lines and some comments restate the code. Action granularity: Statements generally perform one action per line. Reading flow: Methods progress naturally from request information to header handling and property wrappers, although the late threading import and redundant loop interrupt the flow.