Sample
pyint-78ae0e10f261-I13
Lower every eligible synchronous for loop to a while loop
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.845 | 0–1; higher is more readable |
| Mi | 0.526 | 0–1; higher is more readable |
| LLOC | 23 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.486 | 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. | 1269.981 | −41.909 |
| Source linesThe number of non-empty source lines. | 44 | +17.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.639 | −6.959 |
Intercept 8.87 + feature contributions = -22.398 (log-odds).
Score = sigmoid(-22.398) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 41 | +0.681 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.911 | +0.598 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 45 | −0.557 |
| 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.064 | +0.317 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 43.852 | +0.203 |
| 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. | 86.956 | −0.018 |
Intercept 0.07 + feature contributions = 1.693 (log-odds).
Score = sigmoid(1.693) = 0.845.
| Score | 0.526 |
|---|
| Score | 23 |
|---|
Run 1
The code demonstrates good structure with clear class organization and logical method grouping. Nesting is minimal, with only a single level inside _combine for validation. Intent is evident: implementing bitwise combinable lexemes for PostgreSQL full-text search. The code is appropriately concise — helper methods reuse _combine to avoid duplication. Each action is separated per line, maintaining granularity. Reading flow follows a natural pattern: constants, core logic, then operator overloads. The type check and error message are clear. Minor deductions: no type hints, and the comment about abusing operators could be slightly clearer for readers unfamiliar with Django internals. Overall, readable code with strong maintainability.
Run 2
The code is well-structured, with a clear class definition and logically organized methods. Nesting is minimal—only one level in `_combine`. The intent is evident: providing bitwise composition for lexemes with consistent operand handling. Code length is concise and avoids redundancy. Each action is on its own line, especially in the operator overloads. Reading flow is natural, aided by clear comments explaining the design choice. Minor deductions: the repetitive operator methods could be simplified with a utility, but the current form is still very readable.
Run 3
The code is well-structured and readable. It defines a mixin class for combining lexeme objects using bitwise operators. The `_combine` method centralizes logic, reducing duplication across `__or__`, `__and__`, and their reversed variants. Nesting is flat, with only one conditional block. Intent is clear: the class enables logical combination of lexemes, and the comment explains the deliberate use of bitwise operators despite Django's usual discouragement. Code length is concise and appropriate for the functionality. Each method performs a single action per line, maintaining good action granularity. Reading flow is natural, with the helper method first and operator overloads following. Minor deductions are for slight ambiguity in the comment wording and lack of type hints, but overall readability is high.
Run 1
Code Structure: Imports are grouped logically, and the class cleanly separates combination logic from operator overloads. Nesting: The implementation is shallow, with straightforward conditionals and early returns. Clarity of intent: Descriptive class and method names, connector constants, and an informative error message communicate the purpose; the comment explains the unconventional operator usage. However, the parameter name 'reversed' shadows a built-in, and CombinedLexeme is not defined in this excerpt. Code length: The code is concise, with necessary repetition for operator overloads, although many imports are unused within the shown snippet. Action granularity: Each statement performs a single clear action. Reading flow: Constants, shared logic, and thin operator wrappers form a natural progression, with consistent formatting.
Run 2
Code Structure: The class logically groups operator constants, shared combination logic, and operator overloads, avoiding duplication. Nesting: Control flow is shallow, with simple checks and early returns. Clarity of intent: Descriptive names, a precise error message, and a contextual comment make logical lexeme combination clear; the parameter name 'reversed' shadows a built-in, and positional booleans slightly obscure call intent. Code length: Methods are concise, though many imports are unused in the shown snippet. Action granularity: Each statement performs one clear action, with multiline formatting improving readability. Reading flow: The progression from constants to helper logic to operator methods is natural, although missing blank-line separation around the local import and class slightly weakens formatting.
Run 3
Code Structure: The class logically groups combination logic and operator overloads, with shared behavior centralized in _combine. Nesting: Shallow conditionals and early returns keep control flow easy to follow. Clarity of intent: Descriptive class and method names, explicit operator constants, and a helpful comment explain logical combination; however, the parameter name reversed shadows a built-in, and CombinedLexeme is not defined in the snippet. Code length: Methods are concise, though many imports are unused in the provided excerpt. Action granularity: Each statement performs a single clear action, and the multiline exception message remains readable. Reading flow: Imports, constants, shared implementation, and operator wrappers appear in a natural order. Minor spacing and external-context dependencies prevent a perfect score.