Sample
pyint-4bcf4aa0737f-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.84 | 0–1; higher is more readable |
| Mi | 0.578 | 0–1; higher is more readable |
| LLOC | 20 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.67 | 0–20; mean of three runs |
| BTTF | 0.556 | 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. | 737.534 | −24.339 |
| 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.366 | −6.549 |
Intercept 8.87 + feature contributions = -10.818 (log-odds).
Score = sigmoid(-10.818) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 88 | +0.615 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.05 | +0.455 |
| 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 |
| 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 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 27.809 | −0.021 |
| 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.661 (log-odds).
Score = sigmoid(1.661) = 0.84.
| Score | 0.578 |
|---|
| Score | 20 |
|---|
Run 1
The code is generally readable: imports are grouped logically, the class is focused with a single responsibility, and the validator method is relatively flat. Naming is clear (_InValidator, in_options, _original_options). The error message construction is explicit, and the use of attrs decorators keeps boilerplate low. However, several issues reduce readability: the multi-line raise ValueError has inconsistent alignment—arguments are scattered across lines without clear formatting, which disrupts scanning. The closure of __call__ and class body are properly indented, but the overall vertical spacing makes the function feel longer than necessary. Finally, the purpose of _original_options vs options is implied but not documented, leaving intent slightly ambiguous.
Run 2
The code is generally structured and uses clear naming, but several factors reduce readability. The imports are excessive and disorganized (e.g., unused `operator`, `contextmanager`, `Pattern`). The function `__call__` has moderate nesting (try/except inside method, then conditional), but the error-raising block is overly verbose—splitting a single `ValueError` across five lines breaks action granularity and disrupts natural reading flow. The `msg` construction is compact but could be clearer with an f-string on one line. The class is logically organized, and intent is mostly clear, but the excessive import clutter and multi-line exception call make the code feel longer and less focused than necessary.
Run 3
The code is highly readable with clear structure and intent. It uses a simple class with a straightforward validation pattern, minimal nesting (only one try/except and one if), and concise methods. Each action is on its own line, improving clarity. The imports and decorators are well-organized. The error message is explicit and informative. Minor deductions: multiple arguments to ValueError are split across lines with unusual spacing, and the exception comment is slightly informal. Overall, the code is clean and easy to follow.
Run 1
Code Structure: The validator class logically groups its state, validation behavior, and representation, though several imports appear unused in this snippet. Nesting: Shallow try/except and conditional blocks keep complexity low. Clarity of intent: Membership validation is clear from the names, error message, and explanatory TypeError comment; the distinction between options and _original_options is not explained. Code length: The implementation is concise without substantial redundancy. Action granularity: Statements generally perform one action per line, but the oddly spaced exception arguments reduce visual clarity. Reading flow: Validation proceeds naturally from membership testing to error handling, followed by representation; missing separation between imports and the class decorator slightly weakens formatting.
Run 2
Code Structure: The validator class logically groups its state, validation behavior, and representation, but numerous unused imports clutter the snippet. Nesting: Shallow try/except and conditional blocks are easy to follow. Clarity of intent: Membership validation and the TypeError fallback are clear, aided by the example comment; attrs-specific field configuration requires some familiarity. Code length: The implementation is concise, though imports add unnecessary length. Action granularity: Statements generally perform one action per line, but the awkwardly spaced ValueError arguments reduce readability. Reading flow: Execution proceeds naturally from membership testing to failure reporting, although missing spacing before the class decorator and inconsistent argument formatting interrupt the visual flow.
Run 3
Code Structure: The small validator class is logically organized into fields, validation, and representation, although several imports appear unused in this snippet and spacing before the class is missing. Nesting: Shallow try/except and conditional blocks make control flow easy to follow. Clarity of intent: Descriptive names, a helpful TypeError example, and a clear error message communicate membership validation well; the distinction between options and _original_options is not explained. Code length: The implementation is concise without unnecessary logic, though unused imports add clutter. Action granularity: Most lines perform one action, but the irregularly spaced, multiple arguments on one line in the ValueError call reduce readability. Reading flow: Validation proceeds naturally from membership testing to failure reporting, followed by representation; inconsistent formatting slightly interrupts the otherwise smooth flow.