Sample
pyint-7117da13df43-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.277 | 0–1; higher is more readable |
| Dorn | 0.853 | 0–1; higher is more readable |
| Mi | 0.751 | 0–1; higher is more readable |
| LLOC | 9 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.67 | 0–20; mean of three runs |
| BTTF | 0.782 | 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. | 242.899 | −8.016 |
| 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.411 | −6.616 |
| Source linesThe number of non-empty source lines. | 12 | +4.8 |
Intercept 8.87 + feature contributions = -0.961 (log-odds).
Score = sigmoid(-0.961) = 0.277.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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. | 40.846 | +1.935 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 13 | +0.576 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 12 | −0.322 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 11.786 | −0.245 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.082 | +0.148 |
Intercept 0.07 + feature contributions = 1.755 (log-odds).
Score = sigmoid(1.755) = 0.853.
| Score | 0.751 |
|---|
| Score | 9 |
|---|
Run 1
The code is highly readable due to its simplicity and clean structure. It demonstrates a clear, focused purpose: defining a single attrs class with an explicit initializer. The structure is logical, with imports grouped, followed by the class definition. Nesting is minimal, with only a single method inside the class. Intent is unambiguous; the class name and attribute type hint make the purpose clear. Code length is concise, with no unnecessary logic. Each action (import statements, decorator, attribute, method, assignment) is on its own line, improving granularity. The reading flow is natural, from imports to class to method. Minor deductions are for the redundant `@attr.s(auto_detect=True)` decorator when a manual `__init__` is provided, which could confuse intent slightly, and the import of `re`, `Any`, `Dict`, `List`, `Tuple`, and `attrs` are unused. These unused imports slightly reduce clarity but do not significantly impact readability.
Run 2
The code is short, flat, and easy to follow. It imports only necessary modules, defines a single class with a clear purpose, and has a simple constructor. The use of `attr.s(auto_detect=True)` and `attrs` is slightly redundant/misleading (importing both `attr` and `attrs`), which hurts clarity. There are no nested blocks or complex logic. Action granularity is good—one statement per line. Reading flow is natural: imports, class definition, attribute declaration, constructor. Overall it is quite readable, but the dual import and unused `re`/`typing` imports introduce minor ambiguity, preventing a higher score.
Run 3
The code is concise and readable. It uses clear imports and defines a single class with an obvious purpose. The use of both 'attr' and 'attrs' imports is slightly redundant and could confuse readers. The 'auto_detect=True' parameter suggests automatic type detection, which is not fully clear without deeper attrs knowledge. Nesting is minimal, action granularity is one action per line, and reading flow is natural. Overall, it is well-structured and easy to follow.
Run 1
Code Structure: Imports and a single small class are logically organized, though several imports are unused and import groups lack separation. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class clearly stores an integer, but the generic class and field names convey little domain meaning, and auto_detect=True requires familiarity with attr. Code length: Concise overall, although unused imports add clutter. Action granularity: Each line performs one clear action. Reading flow: Natural top-to-bottom flow from imports to class declaration and initialization, with minor formatting improvements possible.
Run 2
Code Structure: Clearly organized into imports and a single small class, though several unused imports add clutter. Nesting: Minimal and appropriate, limited to the class and its initializer. Clarity of intent: The typed field and straightforward initialization are clear, but the generic class name and auto_detect decorator require some library familiarity. Code length: Concise, with unnecessary imports being the main excess. Action granularity: Each line performs one action. Reading flow: Natural top-to-bottom progression; separating standard-library and third-party imports and adding another blank line before the class would improve visual organization.
Run 3
Code Structure: Imports and the class are logically organized, though several unused imports add clutter. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class clearly stores an integer, but the generic class name and decorator's auto-detection behavior require some familiarity with attrs. Code length: Very concise, although unused imports could be removed. Action granularity: Each statement performs one action. Reading flow: Natural top-to-bottom flow, with a minor formatting issue: an additional blank line before the top-level class would better follow standard Python style.