Sample
pyint-31a4c5bab686-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.854 | 0–1; higher is more readable |
| Mi | 0.745 | 0–1; higher is more readable |
| LLOC | 27 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 9.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 13 | 0–20; mean of three runs |
| BTTF | 0.243 | 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. | 904.062 | −29.834 |
| Source linesThe number of non-empty source lines. | 46 | +18.4 |
| 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.576 | −6.864 |
Intercept 8.87 + feature contributions = -9.428 (log-odds).
Score = sigmoid(-9.428) = 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. | 44.851 | +1.766 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 44 | +0.785 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 47 | −0.628 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 44 | −0.589 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.051 | +0.45 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 30.106 | −0.319 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 45.826 | +0.231 |
Intercept 0.07 + feature contributions = 1.766 (log-odds).
Score = sigmoid(1.766) = 0.854.
| Score | 0.745 |
|---|
| Score | 27 |
|---|
Run 1
The code starts with a clean import structure and uses modern Python features like __future__ annotations and abc, showing good organization. However, it degrades significantly in the _AndValidator class. There are unexplained magic numbers (72, 85) and dead code comparing scores that has no relevance to the validator's purpose. The __call__ method mixes business logic with completely unrelated variables, making the intent ambiguous. The nested if-else for score comparison is unnecessary and adds confusion. While the overall structure is flat and imports are organized, the core class lacks clarity. The docstring is clear, but the implementation doesn't match its stated purpose. The action granularity is reasonable with one statement per line, but the logical flow is disrupted by inserting irrelevant code before the actual validation loop. The code length is concise but at the cost of clarity due to the misplaced score comparison block.
Run 2
The code begins with a clean import structure and reasonable organization, but the final class contains unexplained variables (first_score, second_score, higher_score) that have no logical connection to the validator's purpose. This creates ambiguity and confusion. The `__call__` method performs a pointless comparison and assignment before its actual validation loop, adding unnecessary length and mixing unrelated logic. The unconditional if/else structure adds nesting without value, making the action granularity poor and obscuring the method's true intent. The reading flow is disrupted by these artifacts, which appear to be leftover or placeholder code. Proper organization and modern typing hints are positive, but the core logic lacks clarity, making the code difficult to read and maintain.
Run 3
The code shows reasonable module organization and imports, but the evaluated section is problematic. The `_AndValidator` class uses decorators (`@attrs`) and functions (`attrib()`) that are not defined in the provided snippet, obscuring intent. The `__call__` method contains irrelevant, hard-coded score comparisons that have no apparent connection to the validator's purpose or functionality. This dead code muddles clarity and action granularity. Nesting is minimal and structure is okay, but the reading flow is disrupted by the meaningless conditional block. Overall, the code lacks consistent clarity and includes extraneous logic, making it difficult to understand at a glance.
Run 1
Code Structure: Imports and the validator class are organized conventionally, but numerous unused imports and an unrelated score-comparison block obscure the core logic. Nesting: Shallow; the conditional and validator loop are easy to follow. Clarity of intent: The class name, docstring, and final loop clearly communicate validator composition, but unused score variables introduce confusing, irrelevant intent. Code length: Excessive for the small amount of meaningful behavior, mainly due to imports and dead code. Action granularity: Each statement performs one action, making individual lines straightforward. Reading flow: Conventional layout helps, but readers must pass through irrelevant imports and score calculations before reaching the actual validation. Abbreviated parameters and the unexplained origins of attrs and attrib further reduce readability.
Run 2
Code Structure: The validator class is logically organized, but the extensive imports and unrelated score comparison distract from its core responsibility. Nesting: Shallow conditional and loop nesting makes the control flow easy to follow. Clarity of intent: The class name and docstring clearly describe validator composition, but the unused higher_score calculation is unexplained, and attrs and attrib are not defined or imported in the shown snippet. Code length: The implementation is short, yet the irrelevant calculation and many unused imports add unnecessary length. Action granularity: Statements generally perform one action per line. Reading flow: Formatting and straightforward validator iteration support readability, but the unrelated conditional interrupts the natural progression from receiving arguments to invoking validators.
Run 3
Code Structure: The validator class is logically organized, but extensive unrelated imports and an unused score-comparison block add clutter. Nesting: Shallow conditionals and a simple loop are easy to follow. Clarity of intent: The class name, docstring, and validator loop clearly express composition, but the arbitrary scores and unused higher_score obscure the method’s purpose; the abbreviated variable v is less descriptive. Code length: The actual validation behavior is concise, yet unnecessary imports and dead code substantially inflate the snippet. Action granularity: Each statement performs one action, with no compressed multi-action lines. Reading flow: Conventional class and method formatting helps, but unrelated calculations interrupt the natural progression to validator execution. The unresolved attrs and attrib names also make the snippet less self-contained.