Sample
pyint-3768911b1a4b-I03
Replace names with length-matched meaningful but unrelated identifiers
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.001 | 0–1; higher is more readable |
| Dorn | 0.856 | 0–1; higher is more readable |
| Mi | 0.748 | 0–1; higher is more readable |
| LLOC | 22 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 10 | 0–20; mean of three runs |
| GPT-6.1 Sol | 13.33 | 0–20; mean of three runs |
| BTTF | 0.696 | 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. | 765.065 | −25.247 |
| Source linesThe number of non-empty source lines. | 40 | +16 |
| 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.665 | −6.998 |
Intercept 8.87 + feature contributions = -7.375 (log-odds).
Score = sigmoid(-7.375) = 0.001.
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.902 | +1.763 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 38 | +0.577 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 38 | −0.451 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.053 | +0.43 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 41 | −0.415 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 28.976 | −0.337 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 39.87 | +0.147 |
Intercept 0.07 + feature contributions = 1.785 (log-odds).
Score = sigmoid(1.785) = 0.856.
| Score | 0.748 |
|---|
| Score | 22 |
|---|
Run 1
The code is a partial snippet showing imports and a small class definition. Organization is logical with imports grouped, and the class uses decorators and docstrings. However, clarity suffers due to the incomplete and ambiguous context: the decorator `@attrs`, `attrib()`, and parameters `flag, item, index` are unexplained, making intent unclear. Variable naming is poor (`age` instead of `validator`), which obscures purpose. Nesting is flat and action granularity is reasonable. Code length is concise, but the lack of surrounding context and unclear naming reduce readability. Overall, structure is sound but semantic clarity is lacking.
Run 2
The code is difficult to evaluate fully because it appears to be an incomplete snippet, but several issues are immediately apparent. The structure is fragmented: it imports many modules and symbols but only shows a small class definition, suggesting the full file may be large and disorganized. Nesting is flat, which is good, but clarity of intent is severely undermined by poor naming — 'age' is used as a loop variable for validators, and 'flag' and 'item' are vague. The class name '_AndValidator' is reasonably clear, but the docstring is minimal and the __call__ method's purpose is ambiguous without context. Code length is acceptable for the visible portion, but the many unused imports (e.g., abc, enum, linecache, weakref, types) inflate the file size without evident purpose. Action granularity is mostly one action per line, but the loop variable 'age' obscures readability. Reading flow is disrupted by the odd variable names and incomplete-looking class. Overall, the snippet lacks the clarity and purposeful organization expected in readable code, though the flat nesting and concise method body prevent a lower score.
Run 3
The code shows good structure with clear imports and a well-defined class, but has significant readability issues. The class has too many responsibilities - it appears to be both a validator and a handler, which creates ambiguity. The method has multiple actions in a single line and the naming is inconsistent ('age' variable name is unclear). The nesting is acceptable but the type hints and decorators add complexity without clear benefit. The code length is reasonable for the functionality, but the intent isn't immediately clear. The reading flow is disrupted by the mixing of concerns and unclear variable names. Better separation of concerns and more descriptive variable names would improve readability.
Run 1
1. Code Structure: Imports and a small validator class are logically organized, but numerous unused imports obscure the relevant dependencies; attrs and attrib are not defined or imported in the snippet. 2. Nesting: Minimal nesting makes the call method easy to follow. 3. Clarity of intent: The class name and docstring clearly describe validator composition, but flag, item, index, and especially age are unclear parameter and variable names. 4. Code length: The implementation is concise, while the extensive import section is disproportionate to the shown functionality. 5. Action granularity: Each statement performs one action, with no compressed multi-operation lines. 6. Reading flow: The class reads naturally from description to stored validators to invocation, but irrelevant imports and ambiguous naming interrupt comprehension.
Run 2
1. Code Structure: Imports precede a small, logically organized validator class, but many imports appear unused, and attrs/attrib are not defined or imported in the snippet. 2. Nesting: Minimal nesting makes the execution path easy to follow. 3. Clarity of intent: The class name and docstring clearly describe validator composition, but names such as flag, item, index, and especially age obscure the arguments and callable roles. 4. Code length: The class is concise, while the lengthy import section adds considerable overhead relative to the shown functionality. 5. Action granularity: Each line performs a single action, with no compressed statements. 6. Reading flow: The class reads naturally from declaration to iteration and invocation, though import clutter and missing blank-line separation between import groups reduce overall readability.
Run 3
Code Structure: Imports and the validator class are logically separated, but many imports are unused in this snippet, and attrs and attrib are not visibly imported. Nesting: Minimal nesting makes execution easy to follow. Clarity of intent: The class name and docstring clearly describe validator composition, but names such as age, flag, item, and index obscure the roles of the validator and its arguments. Code length: The implementation is concise, although the extensive import block overwhelms the small class. Action granularity: Each line performs one clear action. Reading flow: The class reads naturally from declaration to iteration and invocation, but unrelated imports and misleading variable names interrupt comprehension.