Sample
pyint-56d28cefb177-I03
Replace names with length-matched meaningful but unrelated identifiers
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.262 | 0–1; higher is more readable |
| Dorn | 0.866 | 0–1; higher is more readable |
| Mi | 0.747 | 0–1; higher is more readable |
| LLOC | 9 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.67 | 0–20; mean of three runs |
| BTTF | 0.775 | 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. | 245.345 | −8.096 |
| 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.405 | −6.607 |
| Source linesThe number of non-empty source lines. | 12 | +4.8 |
Intercept 8.87 + feature contributions = -1.033 (log-odds).
Score = sigmoid(-1.033) = 0.262.
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. | 38.615 | +2.03 |
| 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.833 | −0.244 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.08 | +0.163 |
Intercept 0.07 + feature contributions = 1.866 (log-odds).
Score = sigmoid(1.866) = 0.866.
| Score | 0.747 |
|---|
| Score | 9 |
|---|
Run 1
The code is generally readable but has several issues. The class structure is simple and logical, with a single attribute and straightforward __init__ method. Nesting is minimal. Clarity of intent is mixed: the AutoDetect class and its 'map' parameter are ambiguous without more context. Code length is concise, but the duplicate imports of both 'attr' and 'attrs' is redundant and the re and typing imports are unused. Action granularity is fine—one action per line. Reading flow is natural, though the unused imports slightly disrupt it. Overall, the code is understandable but could be clearer.
Run 2
The code is short and mostly readable, but has several clarity and structural issues. The class 'AutoDetect' and its constructor parameter 'map' are ambiguously named, obscuring intent. The parameter 'map' shadows Python's built-in 'map' function, which is poor practice and confusing. The use of both 'attr' and 'attrs' imports is redundant unless both libraries are intentionally used, which is not evident here. The class uses 'attr.s(auto_detect=True)' but then defines a custom '__init__', which may conflict with attrs' generated initializer and reduces clarity. Nesting is minimal, and reading flow is straightforward due to the code's brevity. Action granularity is good—one action per line. Overall, the structure is logical but hindered by naming, shadowing, and potential redundancy.
Run 3
The code is mostly readable due to its simplicity and clear structure. It has a logical class definition with a single attribute and straightforward constructor, flat nesting, and good action granularity. The intent is reasonably clear, though the parameter name 'map' shadows the built-in and does not reflect its purpose. The code is concise with no redundancy; however, importing both 'attr' and 'attrs' is somewhat redundant and can raise confusion about which library is intended. The double definition of `__init__` alongside `attr.s` is unnecessary and slightly reduces clarity. Overall, it's clean but has minor naming and import inconsistencies.
Run 1
Code Structure: Imports and the class are logically organized, though several imports are unused and importing both attr and attrs adds clutter. Nesting: Minimal, with only a class and a short constructor. Clarity of intent: The constructor clearly assigns x, but AutoDetect and x provide little domain context, while map shadows a built-in and is an unclear name for an integer. Code length: Very concise, although unused imports are unnecessary. Action granularity: Each line performs a single action. Reading flow: Straightforward top-to-bottom flow, but import grouping and additional spacing before the class would improve presentation.
Run 2
Code Structure: Imports and the class are logically organized, though several imports are unused and importing both attr and attrs adds clutter. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class stores an integer in x, but generic names such as AutoDetect and x provide little context; the parameter map also shadows a built-in. Code length: The implementation is concise, although unused imports are unnecessary. Action granularity: Each line performs a single action. Reading flow: The code reads naturally from imports to the class and initializer, but additional blank lines between imports and the class would improve visual separation.
Run 3
Code Structure: Imports and a single class are logically organized, though several imports are unused and importing both attr and attrs adds clutter. Nesting: Only the minimal class and method nesting is present. Clarity of intent: The annotation and assignment are straightforward, but generic names AutoDetect and x provide little domain context; map also shadows a built-in. Code length: The snippet is concise, with unnecessary imports accounting for most excess. Action granularity: Each statement performs one action. Reading flow: The code reads naturally from imports to class to initialization, although an additional blank line before the top-level class would improve conventional formatting.