Sample
pyint-8435f95d075f-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.839 | 0–1; higher is more readable |
| Mi | 0.318 | 0–1; higher is more readable |
| LLOC | 19 | 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.56 | 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. | 655.551 | −21.633 |
| Source linesThe number of non-empty source lines. | 25 | +10 |
| 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.578 | −6.867 |
Intercept 8.87 + feature contributions = -9.63 (log-odds).
Score = sigmoid(-9.63) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 78.731 | +0.466 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.055 | +0.41 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| 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. | 81.923 | +0.195 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 26 | +0.116 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 24.771 | −0.064 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 23 | +0.058 |
Intercept 0.07 + feature contributions = 1.65 (log-odds).
Score = sigmoid(1.65) = 0.839.
| Score | 0.318 |
|---|
| Score | 19 |
|---|
Run 1
The code is well-structured with clear imports, proper use of frozen attrs, and a single-purpose validator class. Nesting is minimal, and each method has a clear intent. The __call__ method handles validation concisely with a clear error message, while __repr__ provides useful debugging info. However, readability could improve with a type hint for 'inst' (likely unused), a more descriptive docstring, and slightly more context around the class purpose. The mix of validation logic and repr in one small class is acceptable but could be separated for clarity. Overall, it's readable and maintainable with only minor improvements needed.
Run 2
The code is generally readable with clear structure and intent. Imports are organized, the class uses attrs decorators effectively, and the __call__ method has a concise validation flow with a clear error message. The repr method improves debuggability. However, readability is slightly reduced by the condensed conditional in __call__—combining validation, message construction, and exception raising into three lines—which could be split for better action granularity. The unused imports (operator, re, Pattern, contextmanager, etc.) add noise and suggest leftover code. Overall, the code is clean and maintainable but could benefit from minor cleanup.
Run 3
The code is highly readable with clear structure and purpose. It defines a frozen, slotted attrs class for numeric validation, using descriptive attributes and a concise __call__ method. Nesting is minimal (one conditional), and each action is on its own line. The imports appear logical though some (operator, re, Pattern, contextmanager, get_run_validators, set_run_validators, _AndValidator, and_, default_if_none, NotCallableError) are unused in the shown snippet, slightly reducing clarity about actual dependencies. The docstring and __repr__ enhance intent. Overall, it follows clean, idiomatic Python with strong readability.
Run 1
Code Structure: Imports, class attributes, validation logic, and representation are logically organized, though several imports are unused in this snippet. Nesting: Only one conditional level, making control flow easy to follow. Clarity of intent: The class name, comparison fields, and error message clearly express bounded numeric validation; the __call__ docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, with little unnecessary logic. Action granularity: Each statement performs a single action, and message construction is separated from raising the exception. Reading flow: Attributes precede methods naturally, but additional spacing between imports and the class would improve visual separation.
Run 2
Code Structure: The validator is logically organized into attributes, validation behavior, and representation, although numerous unused imports distract from the small class. Nesting: Minimal nesting makes control flow easy to follow. Clarity of intent: Descriptive names and the error message clearly communicate numeric-bound validation; the docstring explains the callable-class design rather than the validation behavior. Code length: The implementation is concise, but unused imports add unnecessary length. Action granularity: Each line performs a single clear action, with message construction separated from raising the exception. Reading flow: Attributes followed by __call__ and __repr__ provide a natural progression; additional spacing between imports and the class would improve visual separation.
Run 3
Code Structure: Imports and a small validator class are logically organized, with validation and representation in separate methods. Nesting: Only one conditional level keeps the code easy to follow. Clarity of intent: Descriptive names and error messages clearly communicate numeric-bound validation, though the docstring explains the callable-class design rather than the method's behavior, and attrs-specific declarations require familiarity. Code length: The implementation is concise, but several imports are unused in the provided snippet. Action granularity: Each statement performs one clear action; message construction and exception raising are appropriately separated. Reading flow: The progression from configuration fields to validation and representation is natural, although an additional blank line before the top-level class would improve visual separation.