Sample
pyint-1afd7de48f1b-I01
Remove comments and docstrings
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.783 | 0–1; higher is more readable |
| Mi | 0.561 | 0–1; higher is more readable |
| LLOC | 19 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.602 | 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. | 909.661 | −30.019 |
| Source linesThe number of non-empty source lines. | 34 | +13.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.33 | −6.496 |
Intercept 8.87 + feature contributions = -14.045 (log-odds).
Score = sigmoid(-14.045) = 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. | 63.971 | +0.956 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 34 | +0.439 |
| 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.059 | +0.365 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 35 | −0.203 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 33.708 | +0.061 |
Intercept 0.07 + feature contributions = 1.281 (log-odds).
Score = sigmoid(1.281) = 0.783.
| Score | 0.561 |
|---|
| Score | 19 |
|---|
Run 1
The code is generally readable with clear class structure and logical organization. The use of the attrs library reduces boilerplate meaningfully. Nesting is minimal, and action granularity is reasonable—most lines perform a single logical operation. Naming is fairly descriptive (e.g., _DeepIterable, member_validator, iterable_validator). However, clarity of intent could be improved: the __call__ method’s purpose is not immediately obvious without context, and the __repr__ string concatenation is somewhat awkward due to the empty string and conditional f-string, making the reading flow slightly unnatural. The import list includes several unused imports (operator, re, Pattern, contextmanager, get_run_validators, set_run_validators, _AndValidator, and_, default_if_none, NotCallableError), which adds noise and suggests potential cleanup. The class is concise overall, but the need to infer the validator behavior and the fragmented repr construction detracts from readability. Still, the flat structure and reasonable line length keep it above average.
Run 2
The code is highly readable with clear structure and logical organization. It uses decorators and typing flows naturally, with a single-purpose class handling deep iterable validation. Nesting is minimal, mostly flat, with one small conditional in __repr__. Intent is clear from naming and docstring-free but self-explanatory methods. Code length is concise without being cryptic. Action granularity is one action per line in most places, especially in __call__ and __repr__. Reading flow is natural: imports, class definition, constructor attributes, then methods in logical order. Minor deductions: slight ambiguity in __call__ regarding why iterable validation happens before member iteration (no comment), and the conditional formatting in __repr__ slightly interrupts flow, but those are minor. Overall, near-exemplary readability.
Run 3
The code is well-structured with clear separation of concerns: imports are organized, class attributes use helper functions, and methods have single responsibilities. Nesting is minimal, with only one conditional block inside __call__ and a ternary in __repr__ that remains readable. Intent is evident from names like _DeepIterable, member_validator, and iterable_validator. The code is concise, though the __repr__ method could be slightly simplified. Each logical action occupies its own line, especially in the conditional and loop. Reading flow is natural—validation logic precedes representation logic, and the conditional structure follows a clear if/then pattern. Minor deductions: the __repr__ string formatting is somewhat fragmented, and the blank line after the method signature is unnecessary. Overall, this is a clean, idiomatic implementation that balances clarity with brevity.
Run 1
Code Structure: The class cleanly separates configuration, validation behavior, and representation, though several imports appear unused in this excerpt. Nesting: Shallow conditionals and a single loop make control flow easy to follow. Clarity of intent: Descriptive validator names clearly communicate iterable and member validation; however, is_callable() and optional() are not defined or imported in the provided snippet. Code length: Compact overall, with slightly verbose formatting in __repr__ and an unnecessary blank line. Action granularity: Each statement performs one clear action. Reading flow: Configuration naturally precedes execution and representation, although the conditional string construction requires a little extra attention.
Run 2
Code Structure: The class logically separates configuration, validation behavior, and representation, though several imports appear unused in this excerpt. Nesting: Control flow is shallow, with a simple conditional and loop. Clarity of intent: Descriptive names make iterable and member validation clear; however, is_callable() and optional() are not defined or imported in the shown code. Code length: The implementation is concise, although the multiline attribute declaration and representation formatting add some visual overhead. Action granularity: Each statement performs a single clear action. Reading flow: Methods follow a natural order, and validation proceeds predictably from the iterable to its members. An extra blank line in __call__ and the split representation string slightly interrupt an otherwise smooth reading experience.
Run 3
Code Structure: The class logically groups validator configuration, validation behavior, and representation, although several imports are unused in this snippet. Nesting: Control flow is shallow, with a single conditional and a simple loop. Clarity of intent: Descriptive names make iterable and member validation easy to understand; however, is_callable and optional are referenced without definitions or imports in the provided code. Code length: The implementation is concise, though the multiline conditional expression and string construction make __repr__ slightly more cumbersome than necessary. Action granularity: Each statement performs one clear action, with no compressed or compound statements. Reading flow: Configuration followed by __call__ and __repr__ provides a natural progression. Minor formatting inconsistencies, including a whitespace-only line, slightly reduce polish.