Sample
pyint-a7583c59874b-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.001 | 0–1; higher is more readable |
| Dorn | 0.769 | 0–1; higher is more readable |
| Mi | 0.251 | 0–1; higher is more readable |
| LLOC | 16 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 0–20; mean of three runs |
| BTTF | 0.607 | 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. | 626.468 | −20.673 |
| Source linesThe number of non-empty source lines. | 28 | +11.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.415 | −6.623 |
Intercept 8.87 + feature contributions = -7.226 (log-odds).
Score = sigmoid(-7.226) = 0.001.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 104 | +0.874 |
| 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. | 104 | −0.74 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.051 | +0.45 |
| 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. | 26 | +0.162 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 27.752 | −0.022 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 29 | +0.01 |
Intercept 0.07 + feature contributions = 1.201 (log-odds).
Score = sigmoid(1.201) = 0.769.
| Score | 0.251 |
|---|
| Score | 16 |
|---|
Run 1
The code is well-structured and readable. It imports only necessary modules, uses a class with a clear decorator to define validation behavior, and keeps methods short and focused. The `__call__` method uses a single level of nesting with a clear conditional, and the error message is informative. The `__repr__` is concise. There is one minor issue: a blank line after the `if` statement before `raise`, which slightly interrupts flow, but overall clarity, intent, and granularity are strong.
Run 2
The code is well-structured with a single, focused class and clear imports, though some imports (operator, re, Pattern, get_run_validators, set_run_validators, _AndValidator, and_, default_if_none, NotCallableError) appear unused, slightly reducing clarity. Nesting is minimal—only one level in the __call__ method—which is good. The intent is clear: validate an instance type. The code is concise and does not repeat logic. Action granularity is mostly one action per line, but raising TypeError with a multi-line tuple/format string is slightly dense; breaking it into steps could improve readability. Reading flow is natural: class definition, callable method, then repr. The docstring explains the design choice. Overall, it is highly readable with only minor issues around unused imports and the slightly dense raise statement.
Run 3
The code is well-structured and readable. Imports are organized, the validator class has a clear single responsibility, and validation logic is straightforward. Nesting is minimal, clarity of intent is high, and the code is appropriately concise. The use of a callable class is explained via comment, and the __repr__ method improves debuggability. Minor deductions: the blank line after the if statement slightly disrupts flow, and the long f-string in the TypeError is understandable but could benefit from a helper variable. Overall, the code demonstrates good practices in structure, granularity, and readability.
Run 1
Code Structure: The validator class is logically organized into a field, validation method, and representation method, though several imports are unused in this snippet. Nesting: A single conditional keeps nesting shallow. Clarity of intent: The class name, isinstance check, and descriptive exception clearly communicate validation behavior; abbreviated parameters and a docstring explaining representation rather than validation slightly reduce clarity. Code length: The implementation is concise, with a redundant pair of parentheses around the error message and an unnecessary blank line. Action granularity: Each statement performs one clear action, and exception arguments are neatly separated across lines. Reading flow: The progression from configuration to validation to representation is natural, although the long error-message line and minor formatting inconsistencies interrupt readability.
Run 2
Code Structure: Imports and a small validator class are logically organized, though several imports are unused in this snippet. Nesting: A single conditional keeps the implementation shallow. Clarity of intent: Descriptive class and method names, isinstance checking, and a detailed error message make the purpose clear; the docstring explains the callable-class design rather than the validation behavior. Code length: The implementation is concise, but redundant parentheses around the error string and an empty line before raise add clutter. Action granularity: Each statement performs one clear action, with exception arguments sensibly split across lines. Reading flow: The class progresses naturally from its type field to validation and representation; the long error-message line and limited spacing between imports and the class slightly reduce scanability.
Run 3
Code Structure: Imports and a focused validator class are logically organized, though several imports are unused in this snippet. Nesting: A single conditional keeps nesting shallow. Clarity of intent: Class and method names clearly indicate type validation; the docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, but redundant parentheses around the error message and an empty line inside the conditional add clutter. Action granularity: Each statement performs one clear action, and the exception arguments are neatly separated. Reading flow: Initialization, validation, and representation follow a natural sequence, although the long error-message line slightly interrupts readability.