Sample
pyint-1efaf8b0eef6-I03
Replace names with length-matched meaningful but unrelated identifiers
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.859 | 0–1; higher is more readable |
| Mi | 0.333 | 0–1; higher is more readable |
| LLOC | 16 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.557 | 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. | 714.305 | −23.572 |
| 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.301 | −6.451 |
Intercept 8.87 + feature contributions = -9.553 (log-odds).
Score = sigmoid(-9.553) = 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.333 |
|---|
| Score | 16 |
|---|
Run 1
The code is highly readable. It has a clear, logical structure with a single class containing focused methods. Nesting is minimal, with only one if statement inside the __call__ method. Intent is clear: validate that an item is callable. The code is concise without unnecessary verbosity. Action granularity is good, with each meaningful operation on its own line, though the error message construction spans multiple lines for clarity. Reading flow is natural, moving from import statements to class definition to method implementations. The repr method is appropriately simple. The only minor readability concerns are the multi-line string formatting and the unused imports (operator, re, Pattern, contextmanager, etc.), which could cause slight confusion, but these don't significantly impact the core readability of the validator class itself.
Run 2
The code is well-structured and readable. It uses clear imports, a simple class decorator, and a single `__call__` method with a focused validation check. Intent is explicit: validate that an item is callable and raise a meaningful error otherwise. The error message construction is clear despite being multi-step. Nesting is minimal—only one condition but no deep branches. Each action (check, raise, format) is on its own logical line. The `__repr__` is concise. Minor readability cost comes from the string formatting being split across lines and the use of `group.__class__` instead of a shorter form, but these are minor. Overall the code is clean, maintainable, and easy to follow.
Run 3
The code is quite readable. It uses clear imports, a well-named class, and a single, focused method. The error message construction via a template string and a separate raise statement is clean. The `@attrs` decorator and `__repr__` are concise. Minor deductions for the unused `Pattern` and `operator`/`re` imports which add noise, and the slightly awkward variable name `group` in `__call__` which could be more descriptive (e.g., `value`). Overall, structure is flat, intent is clear, and length is appropriate for its purpose.
Run 1
Code Structure: The validator is logically organized into validation and representation methods, though several unused imports add clutter. Nesting: Only one conditional is used, keeping control flow shallow. Clarity of intent: The class name, callable check, and descriptive exception make the purpose clear, but parameter names such as 'step', 'item', and 'group', plus 'channel' for an error message, are ambiguous. Code length: The implementation is compact, although unused imports and an unused parameter reduce concision. Action granularity: Statements generally perform one action each, and the multiline exception construction is easy to scan. Reading flow: Execution proceeds naturally from checking callability to constructing and raising an error, followed by a simple representation method.
Run 2
Code Structure: The validator class logically groups validation and representation methods, although numerous unused imports add clutter. Nesting: A single conditional keeps control flow shallow; nested formatting calls remain manageable. Clarity of intent: The class name, callable check, and descriptive exception clearly convey the purpose, but parameter names such as step, item, and group, plus channel for an error message, obscure their roles. Code length: The implementation is compact, though the unused imports and a docstring explaining representation rather than validation reduce focus. Action granularity: Statements generally perform one action each, with multiline formatting improving readability. Reading flow: Execution proceeds naturally from checking callability to constructing and raising an error, followed by representation customization; unconventional naming and limited spacing between top-level definitions slightly interrupt that flow.
Run 3
Code Structure: The validator class logically groups validation behavior and its representation, although several unused imports add clutter. Nesting: A single conditional keeps control flow shallow; multiline formatting adds visual depth without complex logic. Clarity of intent: The class name, callable check, and descriptive exception clearly communicate the purpose, but parameter names such as step, item, and group are vague, and channel is misleading for an error-message template. Code length: The implementation is concise, though unused imports and the unused step parameter distract from its core behavior. Action granularity: Statements generally perform one action each, with readable formatting for the exception construction. Reading flow: Execution proceeds naturally from checking callability to constructing and raising an error, followed by a simple representation method. Framework-specific decorators and attributes require some background knowledge.