Sample
pyint-5d6c283bc452-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.869 | 0–1; higher is more readable |
| Mi | 0.375 | 0–1; higher is more readable |
| LLOC | 40 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.463 | 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. | 2118.047 | −69.896 |
| Source linesThe number of non-empty source lines. | 60 | +24 |
| 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.381 | −6.571 |
Intercept 8.87 + feature contributions = -43.596 (log-odds).
Score = sigmoid(-43.596) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 57 | +1.234 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 61 | −1.123 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 88 | +0.615 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 59.854 | +0.427 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.063 | +0.332 |
| 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. | 88 | −0.062 |
Intercept 0.07 + feature contributions = 1.891 (log-odds).
Score = sigmoid(1.891) = 0.869.
| Score | 0.375 |
|---|
| Score | 40 |
|---|
Run 1
The code is generally well-structured with clear intent, flat nesting, and good action granularity. Each validation step is separated logically. However, minor issues prevent a higher score: variable names like 'invalid_input' are slightly ambiguous, and the __init__ method uses repetitive conditional assignments that could be simplified. The docstring helps clarify purpose, and line length is reasonable. Overall, it maintains good readability patterns with only minor opportunities for improvement.
Run 2
The code is well-structured and readable. It uses a clear class-based design with a single responsibility, logical attribute ordering, and conventional Django patterns. Nesting is minimal, and the __init__ method uses flat conditional assignments that clearly map arguments to attributes. Intent is explicit, with descriptive names like 'inverse_match' and 'invalid_input'. The code is concise, avoiding unnecessary verbosity. Action granularity is appropriate—expressions like 'invalid_input = regex_matches if ... else not regex_matches' are clear and not overloaded. The __eq__ method is readable despite its vertical formatting, though it could be slightly more compact. Reading flow is natural: initialization, validation logic, then equality comparison. Minor deductions for the slightly repetitive __init__ conditional block and the multi-line boolean expression in __eq__, but overall this is highly readable, idiomatic Python code.
Run 3
The code is well-structured and highly readable. It follows a logical class-based organization with clear separation of concerns: attribute defaults, initialization with optional overrides, validation logic, and equality comparison. Nesting is flat, with minimal conditional depth. Intent is clear from method and attribute names like 'inverse_match', 'regex_matches', and 'invalid_input'. The code is concise without being cryptic, and each action is generally on its own line. Reading flow proceeds naturally from imports through class definition, initialization, validation, and comparison. Docstrings and comments clarify complex logic where necessary. Minor deductions: the equality method could benefit from a brief comment, and the class-level attributes could be separated from the methods with blank lines for slightly better visual grouping. Overall, this is exemplary Python code.
Run 1
Code Structure: The class is logically organized into defaults, initialization, validation, and equality comparison, though several imports are unused in this snippet. Nesting: Control flow is shallow, with straightforward conditionals. Clarity of intent: Descriptive names, a useful validation docstring, and a clear error message make the purpose evident; the inverse-match expression requires slight extra attention. Code length: Concise overall, although initialization repeats similar conditional assignments. Action granularity: Each statement performs a single clear action, and longer expressions are sensibly split across lines. Reading flow: Methods follow a natural order, with consistent formatting and spacing; additional separation between imports and the class would improve presentation.
Run 2
Code Structure: The validator is logically organized into defaults, initialization, validation, and equality methods, though several unused imports add clutter. Nesting: Shallow conditionals keep control flow easy to follow. Clarity of intent: Descriptive names and the validation docstring clearly communicate purpose; inverse-match logic requires slight extra attention. Code length: Concise overall, with repetitive initialization checks that are straightforward rather than unnecessarily verbose. Action granularity: Each statement performs a distinct action, and multiline expressions are formatted clearly. Reading flow: Methods follow a natural sequence, with consistent indentation and readable line breaks. Minor distractions include redundant parentheses in equality checks and limited spacing between imports and the class.
Run 3
Code Structure: The class cleanly separates defaults, initialization, validation, and equality comparison, though several imports are unused in this snippet. Nesting: Shallow conditionals and no loops keep complexity low. Clarity of intent: Descriptive names, a helpful validation docstring, and an explicit error message make the purpose clear; inverse-match logic requires slight extra attention. Code length: Compact overall, with some repetitive but straightforward initialization checks. Action granularity: Each statement performs one clear action, and multiline expressions are appropriately formatted. Reading flow: Methods follow a natural progression, and consistent formatting makes the code easy to scan. Minor spacing improvements around imports and the class would enhance readability.