Sample
pyint-dda159c809f0-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.393 | 0–1; higher is more readable |
| Mi | 0.549 | 0–1; higher is more readable |
| LLOC | 17 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 11 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.598 | 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. | 1000.905 | −33.03 |
| 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.723 | −7.084 |
Intercept 8.87 + feature contributions = -19.644 (log-odds).
Score = sigmoid(-19.644) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 29 | +0.266 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 29 | −0.245 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.08 | +0.162 |
| 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. | 82.967 | +0.151 |
| 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.75 | −0.008 |
Intercept 0.07 + feature contributions = -0.433 (log-odds).
Score = sigmoid(-0.433) = 0.393.
| Score | 0.549 |
|---|
| Score | 17 |
|---|
Run 1
The code demonstrates mixed readability. Imports are organized but formatting is inconsistent: some imports are grouped on single lines while others are awkwardly spaced across multiple lines (e.g., `ExpressionList, Func,` and `Value, When,`). The class definition is clear and the lookup registration pattern is idiomatic Django. The `process_rhs` method is concise and shows clear intent with good action granularity. However, the `prepare_rhs` attribute and method override require Django framework knowledge to fully understand, which slightly reduces clarity for newcomers. The nesting is flat and reading flow is logical, but the import statement formatting creates visual noise. Overall, this is readable code with minor formatting inconsistencies that prevent a higher score.
Run 2
The code shows mixed readability. Imports are unnecessarily verbose and inconsistently formatted—some lines contain multiple imports with odd spacing, while others use separate lines. The class definition is clear in intent and concise, but the method process_rhs has moderate nesting and uses tuple unpacking that slightly obscures the logic. Action granularity is acceptable, with one main operation per line in the method. However, the overall structure suffers from import disorganization and inconsistent style, reducing clarity. The code is short but not consistently formatted, affecting natural reading flow. While the logic itself is simple, the presentation undermines readability.
Run 3
The code begins with a cluttered import section, with multiple imports placed on single lines and inconsistent alignment, reducing readability. The function `process_rhs` is straightforward but lacks clarity in intent due to the use of abbreviations like `rhs`, `qn`, and `params` without explanation. Nesting is shallow, which is a positive, but the single line `params = (connection.ops.prep_for_iexact_query(params[0]), *params[1:])` performs multiple actions and is difficult to parse. The class definition is concise and logically placed, but the import section dominates and feels disorganized. Overall, the code would benefit from reformatting imports, expanding abbreviations, and breaking down the complex tuple assignment into clearer steps.
Run 1
Code Structure: Imports precede a focused lookup class, providing logical organization, though several imports are unused in this snippet and BuiltinLookup is not visibly imported. Nesting: Shallow, with only one conditional inside the method. Clarity of intent: The class name, lookup_name, and prep_for_iexact_query call clearly indicate case-insensitive exact-match preparation; qn is less descriptive. Code length: The implementation is concise, but the extensive import block adds clutter relative to the small class. Action granularity: Executable statements generally perform one action per line; inconsistently grouping imported names reduces visual clarity. Reading flow: The method naturally progresses from superclass processing to parameter preparation and return, but irregular import spacing and line breaks interrupt scanning.
Run 2
Code Structure: The lookup class is logically organized, with configuration attributes followed by its processing method, though the imports are poorly formatted and mostly unused in this snippet. Nesting: Only one shallow conditional keeps complexity low. Clarity of intent: The class name, lookup_name, and preparation method convey case-insensitive exact matching, although qn is opaque and BuiltinLookup is not defined or imported in the excerpt. Code length: The implementation is concise, but the extensive import block adds distracting overhead. Action granularity: Method statements generally perform one action per line; several import lines awkwardly combine multiple names. Reading flow: The method flows naturally from superclass processing to conditional parameter preparation and return, but inconsistent import spacing and line breaks interrupt readability.
Run 3
Code Structure: The lookup class is logically organized, but inconsistent import formatting detracts from cleanliness. Nesting: A single conditional keeps the method shallow and easy to follow. Clarity of intent: The class name, lookup name, and preparation method communicate case-insensitive exact matching, although abbreviated names and the undefined-in-snippet BuiltinLookup require framework context. Code length: The implementation is concise, but many imports are unused in the displayed code. Action granularity: Method statements generally perform one action per line; multiple imported names crowded onto individual lines reduce visual clarity. Reading flow: The method naturally progresses from superclass processing to conditional parameter preparation and return, while irregular import spacing and insufficient separation before the class interrupt an otherwise clear flow.