Sample
pyint-92aa87136777-I10
Deterministically remove some optional blank lines and bracketed line breaks
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 | 17 | 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 highly readable due to its clean structure and clarity. Imports are organized logically, with standard library imports first, followed by third-party packages. The class definition is concise and uses a clear, conventional pattern for attrs integration. There is minimal nesting, and actions are well-separated per line. The intent is straightforward: define a simple data class with an explicit constructor. Redundancy in declaring both the field and the custom __init__ slightly reduces brevity, but the code remains easy to understand. Overall, the flow is natural and unobstructed.
Run 3
The code is short and mostly clear, but it has structural and clarity issues that lower its readability. The class uses `@attr.s(auto_detect=True)` from the `attr` library while also importing `attrs`, creating an unnecessary dual-import and potential confusion about which library is intended. The explicit `__init__` method is redundant with `attr.s` auto-generation, making the code longer than necessary. The unused imports (`re`, `Any`, `Dict`, `List`, `Tuple`) clutter the top and suggest incomplete cleanup. Nesting is flat and action granularity is fine. Reading flow is okay, but the mixed use of two similar libraries and dead imports obscure intent. Overall, it is readable but could be improved by removing unused imports, dropping the redundant constructor, and choosing either `attr` or `attrs` consistently.
Run 1
Code Structure: Imports and the class are logically organized, though several imports are unused and spacing between top-level elements could improve. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The typed attribute and constructor clearly show how x is initialized, but the generic class name and unexplained auto_detect setting provide little context. Code length: Very concise, with unnecessary imports adding minor clutter. Action granularity: Each statement performs one action. Reading flow: Natural progression from imports to decorator, class, and initialization; importing both attr and attrs unnecessarily introduces slight confusion.
Run 2
Code Structure: Imports and the class are logically organized, though several imports are unused and add clutter. Nesting: Only the necessary class and method nesting is present. Clarity of intent: The class clearly stores an integer, but the generic class name and decorator's auto-detection behavior offer limited context. Code length: Very concise, although unnecessary imports reduce efficiency. Action granularity: Each statement performs one action, with no compressed compound statements. Reading flow: Straightforward from imports to decorator, class, and initialization; additional spacing between import groups and the class would improve presentation.
Run 3
Code Structure: Imports and the class are logically organized, though several imports are unused. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class clearly stores an integer, but the generic name and auto_detect decorator do not explain its broader purpose. Code length: Very concise, although unused imports add clutter. Action granularity: Each line performs a single action. Reading flow: Natural top-to-bottom flow, with minor spacing improvements needed between import groups and before the class.