Sample
pyint-3cf227b3c1fa-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.378 | 0–1; higher is more readable |
| Mi | 0.599 | 0–1; higher is more readable |
| LLOC | 17 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.67 | 0–20; mean of three runs |
| BTTF | 0.623 | 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. | 35 | +14 |
| 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.737 | −7.106 |
Intercept 8.87 + feature contributions = -17.266 (log-odds).
Score = sigmoid(-17.266) = 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. | 35 | +0.473 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 35 | −0.382 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 36 | −0.238 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.081 | +0.157 |
| 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. | 83 | +0.15 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 34.774 | +0.076 |
Intercept 0.07 + feature contributions = -0.498 (log-odds).
Score = sigmoid(-0.498) = 0.378.
| Score | 0.599 |
|---|
| Score | 17 |
|---|
Run 1
The code is generally well-structured and readable. Imports are logically grouped (standard library, Django core, models, utilities), although the alphabetical sorting within the Django sections is slightly broken ('fields' before 'expressions' before 'query_utils' before 'utils'). The class definition is flat, with only one level of nesting inside the method. The purpose of the custom lookup is clear from the class name and lookup_name. The method is concise, with a single action per line, and the conditional update of params is straightforward. Variable names like 'rhs' and 'params' follow Django conventions, aiding familiarity. Overall, the code is easy to follow and maintain.
Run 2
The code is readable and well-structured. Imports are logically grouped (standard library, Django modules), the class has a clear, single responsibility, and methods are concise. The `process_rhs` method uses a clear conditional and tuple unpacking, showing action granularity. However, the lack of surrounding context (e.g., the definition of `BuiltinLookup`) slightly obscures intent, and the tuple slicing with `*params[1:]` could be more explicit, which may momentarily interrupt reading flow. Overall, it is maintainable and logically organized.
Run 3
The code is well-structured and highly readable. Imports are logically organized, grouping standard library, Django core, expressions, fields, query utilities, and utility functions. The class definition is clear with a single responsibility: implementing a case-insensitive exact lookup. Nesting is minimal, with only one conditional inside the method. Intent is explicit—overriding process_rhs to apply database-specific case-insensitive query preparation. Code length is concise, with no unnecessary lines. Action granularity is appropriate, though the tuple construction on line 28 packs multiple operations into one line, slightly reducing clarity. Reading flow is natural: imports, class registration, method override, and parameter transformation. Minor improvements could include unpacking params with a more descriptive variable name than the single-character `*params[1:]` pattern, but overall the code is clean, maintainable, and follows Django conventions well.
Run 1
Code Structure: Imports, registration, class attributes, and the method are logically organized, though many imports are unused in this snippet and BuiltinLookup is not shown as imported. Nesting: A single conditional keeps nesting shallow. Clarity of intent: IExact, lookup_name, and prep_for_iexact_query clearly suggest case-insensitive exact matching; qn and the tuple reconstruction require some framework knowledge. Code length: The implementation is concise, but the extensive import block adds visual overhead. Action granularity: Each statement performs one coherent action, with parameter preparation and reconstruction reasonably combined. Reading flow: The method naturally progresses from superclass processing to optional parameter adjustment and return.
Run 2
Code Structure: A clearly organized lookup class contains configuration attributes and one focused method, although many imports are unused in this snippet. Nesting: A single conditional keeps control flow shallow. Clarity of intent: The class name, lookup_name, and preparation call communicate case-insensitive exact matching, but qn is cryptic and BuiltinLookup is not defined or imported here. Code length: The implementation is concise; the extensive import block adds unnecessary reading overhead for the shown code. Action granularity: Each statement performs one coherent action, with parameter transformation expressed compactly. Reading flow: Processing the right-hand side, conditionally preparing its first parameter, and returning the result follows a natural sequence.
Run 3
Code Structure: The lookup class is logically organized, with configuration attributes followed by a focused method. Nesting: A single conditional keeps nesting shallow. Clarity of intent: The class name, lookup_name, and prep_for_iexact_query clearly indicate case-insensitive exact-match preparation, although qn and the externally defined BuiltinLookup require framework knowledge. Code length: The implementation is concise, but numerous imports are unused in this excerpt and add clutter. Action granularity: Each statement performs one coherent action; tuple unpacking and parameter reconstruction are compact but understandable. Reading flow: The method naturally progresses from superclass processing to conditional parameter preparation and returning results. An additional blank line before the decorated class would improve formatting.