Sample
pyint-705a806dccfb-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.799 | 0–1; higher is more readable |
| Mi | 0.204 | 0–1; higher is more readable |
| LLOC | 16 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.624 | 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. | 739.345 | −24.398 |
| Source linesThe number of non-empty source lines. | 21 | +8.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.726 | −7.09 |
Intercept 8.87 + feature contributions = -14.218 (log-odds).
Score = sigmoid(-14.218) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 82.227 | +0.522 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.065 | +0.307 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 22 | +0.257 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 20.805 | −0.119 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 19 | −0.08 |
| 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. | 86 | +0.023 |
Intercept 0.07 + feature contributions = 1.378 (log-odds).
Score = sigmoid(1.378) = 0.799.
| Score | 0.204 |
|---|
| Score | 16 |
|---|
Run 1
The code is highly readable with clear structure and purpose. It follows standard Python conventions with proper imports, type hints, and docstrings. The class hierarchy is logical (inherits from IOError), and the constructor clearly handles optional 'response' and 'request' parameters. Nesting is minimal (one conditional block), and the conditional logic is straightforward. Each action is on its own line, maintaining good granularity. The reading flow is natural - from argument parsing to attribute assignment to fallback logic. Minor deductions: the conditional could be slightly more explicit with parentheses for clarity, and the attribute annotations could use a comment explaining the None default. Otherwise, the code is concise, well-organized, and easy to follow.
Run 2
The code is well-structured and readable. It defines a custom exception class with a clear docstring, type hints, and a logical __init__ method. The use of kwargs.pop() cleanly separates internal attributes from standard exception arguments. Nesting is minimal—only one conditional, which is flat and easy to follow. Intent is explicit: attach request/response context to exceptions. Code length is concise with no redundancy. Each line performs a single logical action. Reading flow is natural, from class docstring to attribute declarations to initialization logic. Minor deductions: the conditional could be slightly clearer with a comment explaining the fallback to response.request, and the double negative 'not self.request' is slightly less intuitive than checking 'if self.request is None'.
Run 3
The code is highly readable. It has clear structure with a single class definition, minimal nesting, and explicit type annotations. The docstring and inline comment clarify intent. Each logical action is on its own line, enhancing granularity. The conditional is flat and readable, though slightly verbose. The reading flow is natural, from imports to class definition to method initialization. Minor deductions: the conditional could be simplified, and the type annotation repetition slightly increases length, but overall this is clean, maintainable code.
Run 1
Code Structure: Imports, class documentation, attribute annotations, and initialization are logically organized. Nesting: A single conditional keeps the implementation shallow and easy to follow. Clarity of intent: Descriptive names, type hints, and the initializer docstring clearly explain how request and response objects are attached, although the class docstring is vague and Response, Request, and PreparedRequest are not defined or imported in the excerpt. Code length: The implementation is concise, but several imports appear unused. Action granularity: Each statement performs one clear action; the compound condition remains manageable. Reading flow: Initialization proceeds naturally from extracting arguments to assigning attributes, deriving a missing request, and initializing the superclass. Additional blank lines between import groups and before the class would improve visual separation.
Run 2
Code Structure: Imports, class documentation, attribute annotations, and initialization are logically organized. Nesting: A single conditional keeps the code nearly flat. Clarity of intent: Descriptive names and the initializer docstring clearly explain attaching request and response objects, although the class docstring is vague and the referenced request/response types are not defined in this snippet. Code length: The implementation is concise, but several imports are unused in the provided code. Action granularity: Each line performs one clear operation. Reading flow: Initialization proceeds naturally from extracting metadata to inferring the request and initializing the superclass; the compound conditional requires only minor additional attention.
Run 3
Code Structure: Imports, class documentation, attribute annotations, and initialization are logically organized. Nesting: Only one conditional keeps the code shallow and easy to follow. Clarity of intent: Descriptive names, type hints, and the initializer docstring clearly explain request/response handling, although the class docstring is vague and referenced types are not imported in the snippet. Code length: The implementation is concise, but several imports are unused in the displayed code. Action granularity: Each statement performs one main action; the compound conditional is readable but slightly dense. Reading flow: Initialization proceeds naturally from extracting the response to assigning attributes, inferring the request, and initializing the superclass. Additional spacing between imports and the class would improve presentation.