Sample
pyint-c78867bad10d-I01
Remove comments and docstrings
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 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 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 concise and has a clear structure. It imports necessary modules and defines a single class with a straightforward attribute. Nesting is minimal, and each line represents a single action, aiding readability. However, there are minor clarity issues: the attrs decorator uses auto_detect=True while also defining an explicit __init__, which is redundant and could confuse readers about the intended construction pattern. The imports include both 'attr' and 'attrs' without clear justification, and the unused 're', 'Any', 'Dict', 'List', 'Tuple' imports reduce cleanliness. The reading flow is natural despite these ambiguities. Overall, it is readable but slightly hindered by redundant code and unused imports.
Run 2
The code is concise and readable. It imports only necessary modules, though 're', 'Any', 'Dict', 'List', 'Tuple', and 'attrs' are unused, which slightly reduces clarity. Class structure is flat, with a clear single responsibility. Attribute definitions are explicit and the auto_detect=True parameter is straightforward. The __init__ method is simple, performing one action per line. Overall structure and flow are logical.
Run 3
The code is generally readable but has several minor issues that prevent a higher score. The structure is logical with clear imports and a single class definition, but the duplicate import of 'attr' and 'attrs' is redundant and confusing. The nesting is flat and the class is concise. The clarity of intent is mostly good, but the 'auto_detect=True' decorator and the explicit __init__ method are slightly contradictory—it's unclear why both are needed. The code length is appropriate, but the action granularity could be improved by removing the unnecessary __init__ method. The reading flow is natural, with imports at the top and a simple class definition, but the duplicate imports disrupt the flow.
Run 1
Code Structure: Imports and a single class are logically organized, though unused imports add clutter and spacing between import groups and the class could improve. Nesting: Minimal, with only a class and its initializer. Clarity of intent: The typed field and straightforward initializer are clear, but the generic class name and interaction between auto-detection and the explicit initializer are less self-explanatory. Code length: Short, although several imports are unnecessary for this snippet. Action granularity: Each statement performs one action. Reading flow: Natural top-to-bottom progression from imports to class definition to initialization.
Run 2
Code Structure: Imports and the class are logically organized, though re, typing names, and attrs are unused and add clutter. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The annotated x attribute and simple constructor clearly describe a small data-holding class, although AutoDetect is a generic name and the decorator requires familiarity with attr. Code length: Very concise, with only unused imports detracting from economy. Action granularity: Each line performs a single declaration or assignment. Reading flow: Natural progression from imports to class to constructor; an additional blank line before the top-level class would improve conventional formatting.
Run 3
Code Structure: Imports and a single class are logically organized, though unused imports add clutter and spacing between top-level elements could improve. Nesting: Minimal, with only a class and its initializer. Clarity of intent: The typed field and straightforward assignment are clear, but the generic class name and auto_detect decorator do not explain the broader purpose. Code length: Short, although unused imports are unnecessary and the explicit initializer may be redundant with attrs-generated initialization. Action granularity: Each line performs one action. Reading flow: Natural top-to-bottom progression from imports to class declaration and initialization, slightly disrupted by unused dependencies.