Sample
pyint-7031081ab055-I08
Select one of ten high-readability unrelated code templates per class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.816 | 0–1; higher is more readable |
| Mi | 0.158 | 0–1; higher is more readable |
| LLOC | 21 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15.33 | 0–20; mean of three runs |
| BTTF | 0.447 | 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. | 734.944 | −24.253 |
| Source linesThe number of non-empty source lines. | 32 | +12.8 |
| 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.38 | −6.569 |
Intercept 8.87 + feature contributions = -9.153 (log-odds).
Score = sigmoid(-9.153) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 96 | +0.744 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.048 | +0.472 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| 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. | 95.879 | −0.396 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 30 | +0.301 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 33 | −0.132 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 31.784 | +0.034 |
Intercept 0.07 + feature contributions = 1.492 (log-odds).
Score = sigmoid(1.492) = 0.816.
| Score | 0.158 |
|---|
| Score | 21 |
|---|
Run 1
The code is generally well-structured and readable. It uses a frozen attrs class with clear attributes, has a logical __call__ method with a clear validation purpose, and includes helpful docstrings and repr customization. Imports are organized but include some unused ones (operator, contextmanager, Pattern, etc.), which slightly reduces clarity. The nesting level is shallow and flow is natural. However, the __repr__ method contains unrelated dummy code (total_score, number_of_scores, average_score) that serves no purpose and misleads the reader, breaking the clarity of intent. Aside from that artifact, the code is concise and each action is clearly delineated.
Run 2
The code is generally clear and well-structured. It uses a frozen/slotted attrs class for a validator, implements `__call__` with a clear error message, and includes a custom `__repr__`. The imports are mostly relevant but `operator`, `re`, `contextmanager`, `get_run_validators`, `set_run_validators`, `and_`, `_AndValidator`, `attrib`, `default_if_none`, and `NotCallableError` appear unused, which hurts readability. Nesting is minimal and the flow is logical. However, the inclusion of irrelevant variables (`total_score`, `number_of_scores`, `average_score`) inside `__repr__` is confusing and seems accidental. These extra imports and dead variables add unnecessary length and ambiguity.
Run 3
The code is mostly clear with logical structure and flat nesting. The validator class is concise and the intent is easy to understand. However, there is a confusing block of unrelated arithmetic (total_score, number_of_scores, average_score) inside __repr__, which is ambiguous and breaks reading flow. Action granularity is generally one action per line. The import of `Pattern` and unused imports like `operator`, `re`, and `contextmanager` reduce readability. Overall, it is readable but slightly marred by the odd dead code in __repr__ and unnecessary imports.
Run 1
Code structure is logical: a small validator class separates validation from representation, though several imports are unused. Nesting is shallow, with only one conditional. Intent is mostly clear from class and attribute names and the descriptive error message, but the __call__ docstring explains representation rather than validation. Code length is modest, although unused score calculations in __repr__ and unused imports add unnecessary clutter. Action granularity is good, with one operation per line and a clearly formatted exception. Reading flow is natural overall, but the unrelated arithmetic in __repr__ interrupts it and suggests leftover code.
Run 2
Code Structure: Imports and validator methods are logically organized, but several unused imports and unrelated score calculations in __repr__ add clutter. Nesting: The code is shallow, with only one conditional inside __call__. Clarity of intent: Class and attribute names, the regex check, and the error message clearly communicate validation behavior; the score calculations have no apparent purpose. Code length: Mostly concise, though unused imports, dead calculations, and the expanded exception call introduce unnecessary length. Action granularity: Each statement performs one action, making individual steps easy to follow. Reading flow: The progression from attributes to validation to representation is natural, but the irrelevant arithmetic interrupts the final method.
Run 3
Code Structure: Imports and validator methods are logically organized, but several imports are unused and unrelated score calculations clutter __repr__. Nesting: Minimal nesting makes control flow easy to follow. Clarity of intent: Class and method names clearly indicate regex validation, and the error message is informative; however, the __call__ docstring explains the class design rather than the method's behavior, and the unused calculations are misleading. Code length: Mostly concise, though unused imports, dead calculations, and an expanded exception call add unnecessary length. Action granularity: Each statement performs one action, making individual steps easy to scan. Reading flow: Validation proceeds naturally from checking the value to raising an error, but the unrelated arithmetic interrupts the representation method.