Sample

pyint-c379b06a4f51-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines35

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.5370–1; higher is more readable
Mi0.6120–1; higher is more readable
LLOC17Logical lines; fewer is more readable
DeepSeek V4 Pro150–20; mean of three runs
GPT-6.1 Sol130–20; mean of three runs
BTTF0.6230–1; higher is more readable

Views

Source code

import itertools import math from django.core.exceptions import EmptyResultSet, FullResultSet from django.db.models.expressions import ( Case, ColPairs, Expression, ExpressionList, Func, Value, When, ) from django.db.models.fields import ( BooleanField, CharField, DateTimeField, Field, IntegerField, UUIDField, ) from django.db.models.query_utils import RegisterLookupMixin from django.utils.datastructures import OrderedSet from django.utils.functional import cached_property from django.utils.hashable import make_hashable @Field.register_lookup class IExact(BuiltinLookup): lookup_name = "iexact" prepare_rhs = False def process(self, qn2, con): rhs2, par = super().process_rhs(qn2, con) if par: par = (con.ops.prep_for_iexact_query(par[0]), *par[1:]) return rhs2, par

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(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.1004.431−33.146
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.76−7.141

Intercept 8.87 + feature contributions = -17.417 (log-odds).
Score = sigmoid(-17.417) = 0.

Feature contributions

FeatureValueContribution
(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.66.917+0.831
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.085+0.121
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.34.809+0.077

Intercept 0.07 + feature contributions = 0.147 (log-odds).
Score = sigmoid(0.147) = 0.537.

Score0.612
Score17
Run 1

The code has clear structure with typical Django imports and a concise lookup class definition. The class uses inheritance meaningfully, and the process_rhs override is short with a clear intent: adjust query parameters for case-insensitive exact matching. Nesting is minimal—only one conditional inside the method—and action granularity is appropriate, with each line performing a distinct operation. The import block is somewhat lengthy but follows Django conventions, which aids familiarity for those experienced with Django internals. However, the meaning of 'qn2', 'con', 'rhs2', and 'par' is not immediately obvious without deeper Django knowledge, slightly reducing clarity. The method name 'process' is also generic; a more descriptive name or docstring would improve readability. Overall, the code is reasonably concise and well-organized, but assumes domain familiarity.

Run 2

The code is generally readable but has some areas for improvement. The imports are logically grouped and the class inherits from BuiltinLookup with clear attribute assignments. However, the process method has moderate complexity with tuple unpacking and conditional logic that could be clearer. The use of *par[1:] makes the intent slightly opaque for those unfamiliar with Django's internals. The flat structure and minimal nesting are positive aspects, but the single-letter variable names like 'qn2' and 'par' reduce clarity. Overall, the code follows Django conventions and maintains reasonable action granularity, though the compressed return statement could be more explicit. The reading flow is natural for experienced Django developers but may confuse newcomers due to domain-specific patterns.

Run 3

The code is generally readable but has some weaknesses. Imports are organized alphabetically and logically grouped, which aids navigation. The class definition and method are concise, with clear purpose and minimal nesting. However, the `process` method has ambiguous variable names (`qn2`, `con`, `rhs2`, `par`), reducing clarity of intent. The tuple unpacking with `*par[1:]` is compact but slightly cryptic without context. Action granularity is good—one operation per line. Reading flow is natural, but the lack of docstrings or comments makes the code's purpose less obvious to new readers. Overall, it is maintainable for experienced Django developers but less accessible to newcomers.

Run 1

1. Code Structure: The lookup class is logically organized, but numerous unused imports obscure the small implementation, and BuiltinLookup is not defined or imported in the snippet. 2. Nesting: A single conditional keeps nesting shallow and easy to follow. 3. Clarity of intent: IExact, lookup_name, and prep_for_iexact_query indicate case-insensitive matching, but process, qn2, con, rhs2, and par are vague; the mismatch between process and the delegated process_rhs also raises questions about intent. 4. Code length: The method is concise, but the import section is disproportionately long. 5. Action granularity: Statements generally perform one action per line, though the tuple reconstruction combines parameter conversion and unpacking. 6. Reading flow: The method follows a natural fetch-transform-return sequence, but irrelevant imports and missing base-class context interrupt comprehension.

Run 2

Code Structure: The lookup class is logically organized, but numerous unused imports obscure the small implementation, and BuiltinLookup is not defined or imported in the snippet. Nesting: A single conditional keeps nesting shallow. Clarity of intent: The class name, lookup_name, and preparation function suggest case-insensitive exact matching, but process, qn2, con, rhs2, and par are vague names; the mismatch between process and the delegated process_rhs also raises questions about intent. Code length: The method is concise, although the import section is disproportionately long. Action granularity: Each line generally performs one action; the tuple reconstruction is compact and reasonably readable. Reading flow: The method follows a natural prepare-transform-return sequence, but irrelevant imports and ambiguous identifiers interrupt comprehension.

Run 3

Code Structure: The lookup class is logically organized, but numerous unused imports clutter the snippet, and BuiltinLookup is not defined or imported. Nesting: The single conditional keeps nesting shallow and easy to follow. Clarity of intent: The class name, lookup_name, and prep_for_iexact_query communicate case-insensitive matching, but process, qn2, con, rhs2, and par obscure their roles; the relationship between process and the inherited process_rhs is unclear. Code length: The implementation is concise, but the imports greatly outweigh the functional code. Action granularity: Each line performs a focused operation, with straightforward unpacking, transformation, and return. Reading flow: The method follows a natural sequence, though import clutter and abbreviated names interrupt comprehension.