Sample
pyint-9888b0b752ff-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.859 | 0–1; higher is more readable |
| Mi | 0.334 | 0–1; higher is more readable |
| LLOC | 16 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.67 | 0–20; mean of three runs |
| BTTF | 0.612 | 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. | 711.107 | −23.467 |
| Source linesThe number of non-empty source lines. | 29 | +11.6 |
| 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.279 | −6.419 |
Intercept 8.87 + feature contributions = -9.415 (log-odds).
Score = sigmoid(-9.415) = 0.
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. | 70.967 | +0.659 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.052 | +0.432 |
| 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. | 27 | +0.197 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 54.967 | +0.082 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 30 | −0.026 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 28.889 | −0.006 |
Intercept 0.07 + feature contributions = 1.807 (log-odds).
Score = sigmoid(1.807) = 0.859.
| Score | 0.334 |
|---|
| Score | 16 |
|---|
Run 1
The code is well-structured and highly readable. Imports are organized, the class uses a decorator for concise setup, and the `__call__` method has a clear purpose with a helpful docstring. The error message construction is logical and the validation logic is straightforward. There is one action per line and minimal nesting. The `__repr__` method is simple and explicit. Minor points deducted because the multi-line message string with `.format()` is slightly verbose, and the `msg=` keyword in `NotCallableError` adds a small amount of noise, but overall the code is clean, intent-revealing, and easy to follow.
Run 2
The code is well-structured, flat, and easy to read. It imports only what is needed, defines a single class with clear purpose, and uses a context manager-like decorator pattern (attrs) to reduce boilerplate. The validator's __call__ method has a straightforward flow: check callability, raise a clear error with a formatted message if not callable, otherwise return None. The nesting is minimal (one if statement), and the action granularity is good—each logical action is on its own line or clearly grouped. The docstring and names are descriptive. Minor deductions for the unused import (Pattern) and the slightly verbose error message construction, but overall the code is concise and maintainable.
Run 3
The code is well-structured with a single, clear-purpose class. It uses flat nesting, minimal lines, and one action per statement. The error message is descriptive and formatting is clear. The only minor issue is that the docstring's purpose could be slightly clearer, but overall it is highly readable.
Run 1
Code Structure: Imports and validator methods are logically organized, though several imports are unused in this snippet. Nesting: A single conditional keeps control flow shallow; nested formatting adds only minor visual complexity. Clarity of intent: The class name, callable check, descriptive exception, and custom representation clearly communicate purpose. The docstring explains the callable-class design, although inst is unused. Code length: The implementation is concise, with modest verbosity from multiline message construction and formatting. Action granularity: Statements generally perform one action each, and exception arguments are clearly separated. Reading flow: The progression from validation to error reporting and representation is natural. An additional blank line before the top-level class would improve conventional Python formatting.
Run 2
Code Structure: The callable validator class cleanly separates validation from representation, though several imports are unused in this snippet. Nesting: Shallow control flow with a single conditional makes the logic easy to follow. Clarity of intent: Descriptive names, an explanatory docstring, and a specific exception clearly communicate the purpose. Code length: The implementation is concise; multiline error formatting adds length but improves legibility. Action granularity: Each statement performs a distinct action, with argument lists sensibly split across lines. Reading flow: Imports, class declaration, validation, and representation follow a natural sequence. Extra blank lines between imports and the class would improve visual separation.
Run 3
Code Structure: Clearly organized imports and a small validator class with separate validation and representation methods, though several imports are unused in this snippet. Nesting: Minimal, with only one conditional; nested formatting adds little complexity. Clarity of intent: The class name, callable check, and descriptive exception clearly communicate the purpose, although the docstring explains the class design rather than the method's behavior. Code length: Concise overall, with modest verbosity from formatting the error message. Action granularity: Statements generally perform one action, and multiline exception construction remains easy to follow. Reading flow: Natural progression from checking the value to raising an informative error, followed by the representation method; additional spacing between imports and the class would improve visual separation.