Sample

pyint-7cb4c37b2d37-SRC

Unmodified source class

Lines35

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.3780–1; higher is more readable
Mi0.5990–1; higher is more readable
LLOC17Logical lines; fewer is more readable
DeepSeek V4 Pro16.670–20; mean of three runs
GPT-6.1 Sol17.670–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_rhs(self, qn, connection): rhs, params = super().process_rhs(qn, connection) if params: params = (connection.ops.prep_for_iexact_query(params[0]), *params[1:]) return rhs, params

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.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

FeatureValueContribution
(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.

Score0.599
Score17
Run 1

The code demonstrates strong readability through clean structure and clear intent. It uses a single class with a focused purpose (case-insensitive exact lookup) and follows Django's established patterns. The nesting is minimal, with only one conditional block that is flat and easily understandable. The method `process_rhs` is concise, containing just the necessary logic for preparing parameters. Action granularity is appropriate - the tuple unpacking on one line is acceptable given its simplicity, and the conditional contains a single clear operation. Reading flow is natural: imports are organized logically, class definition is clear, and the method follows a logical progression from calling the parent method to processing the result. Minor deductions are for the slightly dense tuple construction with the unpacking operator, which might require a moment to parse, and the implicit reliance on understanding Django's lookup system. Overall, this is well-written code that prioritizes clarity while following framework conventions.

Run 2

The code is generally readable and well-structured. It has a clear purpose—defining a custom Django field lookup—with a flat class hierarchy and minimal nesting. Imports are organized logically, and naming conventions follow Django standards. The `process_rhs` method is concise and uses a single action per line where practical. However, readability is slightly reduced by the dense unpacking syntax in the `params` assignment, which combines slicing and tuple construction on one line. The use of `*params[1:]` is idiomatic but may require a second glance for less experienced readers. Overall, the code is clear and maintainable, with only minor complexity in one line.

Run 3

The code is well-structured with clear imports organized by source. The class definition is concise and focused on a single responsibility. The method overrides a parent method with a clear purpose—preparing parameters for case-insensitive exact matching. Nesting is minimal, with only a single conditional inside the method. Action granularity is appropriate, with one meaningful operation per line. The reading flow is natural: imports, then class registration, then method implementation. The only minor drawback is the use of `super().process_rhs()` which requires some Django internals knowledge, but this is expected for framework-level code. Overall, the code is highly readable and maintainable.

Run 1

Code Structure: Imports, registration, class attributes, and a focused method are logically organized, though many imports are unused in this snippet. Nesting: Only one conditional keeps the method nearly flat. Clarity of intent: The class name, lookup name, and preparation call communicate case-insensitive exact matching; framework-specific names such as rhs and qn require Django familiarity, and BuiltinLookup is not defined or imported here. Code length: The implementation is concise, but the extensive import block adds distracting length. Action granularity: Each statement performs one clear step; the tuple reconstruction is compact without being overly dense. Reading flow: Processing the superclass result, conditionally preparing the first parameter, and returning the result follows a natural sequence.

Run 2

Code Structure: The lookup class cleanly groups its configuration and processing method, although many imports are unused in this excerpt. Nesting: A single conditional keeps the method flat and easy to follow. Clarity of intent: The class name, lookup_name, and prep_for_iexact_query call clearly indicate case-insensitive exact-match handling; understanding BuiltinLookup and the rhs/qn terminology requires framework context. Code length: The implementation is concise, but the extensive import section outweighs the shown functionality. Action granularity: Each statement performs a distinct operation, with the tuple reconstruction expressing one cohesive transformation. Reading flow: The method follows a natural sequence—delegate processing, conditionally prepare the first parameter, and return the result. An additional blank line before the decorated class would improve visual separation.

Run 3

Code Structure: Imports and a focused lookup class are logically organized, although many imports are unused in this snippet and BuiltinLookup is not shown. Nesting: A single conditional keeps the method nearly flat. Clarity of intent: The class attributes and prep_for_iexact_query call communicate case-insensitive exact-match preparation, though rhs and qn require Django context. Code length: The implementation is concise, but the extensive import block distracts from the small class. Action granularity: Each statement performs one clear operation; tuple unpacking and reconstruction are compact and conventional. Reading flow: The method naturally progresses from superclass processing to parameter adjustment and return. An additional blank line before the decorated class would improve formatting.