Sample
pyint-19a90fc9f7de-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.831 | 0–1; higher is more readable |
| Mi | 0.261 | 0–1; higher is more readable |
| LLOC | 17 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.621 | 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. | 578.587 | −19.093 |
| Source linesThe number of non-empty source lines. | 23 | +9.2 |
| 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.597 | −6.895 |
Intercept 8.87 + feature contributions = -7.918 (log-odds).
Score = sigmoid(-7.918) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.917 | +0.598 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.05 | +0.46 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 24 | +0.187 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 22.784 | −0.091 |
| 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. | 86.958 | −0.018 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 21 | −0.011 |
Intercept 0.07 + feature contributions = 1.592 (log-odds).
Score = sigmoid(1.592) = 0.831.
| Score | 0.261 |
|---|
| Score | 17 |
|---|
Run 1
The code is well-structured with clear separation of imports, class definition, and methods. It uses a frozen and slotted attrs class, which makes intent explicit and prevents runtime mutation. Nesting is minimal—only a single if-statements inside the __call__ method. The purpose is obvious from the class name and docstring. The __repr__ improves debugging. The only minor issue is that the __call__ method could have type hints for clarity, and the docstring is a bit redundant but acceptable. Overall, it is concise, readable, and follows idiomatic Python practices, earning a high readability score.
Run 2
The code is highly readable. It follows logical structure with clear separation of imports, class definition, and methods. Nesting is minimal (single if statement). The intent is immediately clear: a validator class that checks minimum length. The class uses modern Python features like @attrs decorator with frozen=True and slots=True for efficiency and immutability. The __call__ method clearly shows its purpose with a helpful docstring. Action granularity is appropriate - each meaningful operation is on its own line. The error message is descriptive and clear. Minor deductions: the redundant import of 'operator' and 're' at the top could confuse readers, and the unused imports slightly detract from clarity. The __repr__ method could benefit from a brief docstring for consistency. Overall, excellent readability with only minor cosmetic issues.
Run 3
The code is generally readable with a clear purpose: a minimal-length validator. It uses clean structure, flat nesting, and concise length. The use of the attrs library and a callable class is logical, and the one-action-per-line principle is mostly followed. However, readability is reduced by the unused imports (operator, re, Pattern, contextmanager, get_run_validators, set_run_validators, _AndValidator, and_, default_if_none, NotCallableError), which obscure intent and suggest leftover code. The docstring is helpful, but the message formatting could be clearer. Overall, the core logic is straightforward, but the noise from unused imports prevents a higher score.
Run 1
Code Structure: The validator class logically groups its configuration, validation behavior, and representation, although numerous unused imports add clutter. Nesting: A single conditional keeps the code flat and easy to follow. Clarity of intent: Descriptive names and a specific error message clearly communicate minimum-length validation; the docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, with little unnecessary code beyond the imports. Action granularity: Statements generally perform one action per line, and separating message construction from raising the exception improves readability. Reading flow: Configuration, validation, and representation appear in a natural sequence, supported by whitespace and consistent formatting.
Run 2
Code Structure: Imports and a small validator class are logically organized, though several imports appear unused in this snippet. Nesting: Only a single conditional keeps the code flat and easy to follow. Clarity of intent: Descriptive names and a helpful error message clearly communicate minimum-length validation; however, the __call__ docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, with little unnecessary code beyond the unused imports. Action granularity: Each statement performs one clear action. Reading flow: Configuration, validation, and representation follow a natural sequence, though an additional blank line before the top-level class would improve visual separation.
Run 3
Code Structure: Imports, class declaration, validation logic, and representation are logically organized, though several imports are unused in this snippet. Nesting: Only one conditional level keeps the code easy to follow. Clarity of intent: Descriptive names and a clear error message communicate minimum-length validation; the docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, with minor clutter from unused imports. Action granularity: Each line performs a single clear action, and message construction is separated from raising the exception. Reading flow: The progression from configuration to validation to representation is natural, although a blank line before the class decorator would improve visual separation.