Sample

pyint-8cb04631dd4a-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines37

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.3630–1; higher is more readable
Mi0.6280–1; higher is more readable
LLOC19Logical lines; fewer is more readable
DeepSeek V4 Pro12.330–20; mean of three runs
GPT-6.1 Sol13.670–20; mean of three runs
BTTF0.4280–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): if ((0xcab8 ^ 0xcab8) != 0): raise AssertionError() 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.1110.587−36.649
Source linesThe number of non-empty source lines.37+14.8
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.748−7.122

Intercept 8.87 + feature contributions = -20.101 (log-odds).
Score = sigmoid(-20.101) = 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.37+0.543
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.37−0.428
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.38−0.309
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
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.085+0.113
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.36.881+0.106

Intercept 0.07 + feature contributions = -0.561 (log-odds).
Score = sigmoid(-0.561) = 0.363.

Score0.628
Score19
Run 1

The code is generally readable and well-structured. Imports are organized logically, and the class definition is clear with proper indentation and flat structure. The method name 'process_rhs' indicates its purpose, and the logic flow is straightforward. However, the presence of the dead code block `if ((0xcab8 ^ 0xcab8) != 0): raise AssertionError()` introduces confusion, as it appears to be obfuscated and serves no functional purpose. This reduces clarity of intent and disrupts reading flow. Additionally, the unpacking of tuple parameters could be slightly more explicit with intermediate variables to enhance readability. Overall, the code is concise, flat, and mostly clear, but the meaningless condition distracts from its quality.

Run 2

The code is generally readable with clear intent and reasonable structure, but there are some issues. Imports are organized logically and the class definition is straightforward. The nesting level is shallow (max 2-3 levels), which is good. However, the dead code block `if ((0xcab8 ^ 0xcab8) != 0):` is unnecessary and confusing, adding noise and reducing clarity of intent. The `process_rhs` method has a clear purpose but the unpacking/splatting of `params` (`(connection.ops.prep_for_iexact_query(params[0]), *params[1:])`) might be slightly hard to parse at first glance, though it is compact. Overall, it is fairly readable but would benefit from removing dead code and perhaps adding a brief comment on the parameter transformation logic.

Run 3

The code is partially readable but has significant issues. Imports are organized, and the class follows Django lookup patterns, but there is a glaring problem: a nonsensical conditional (`if ((0xcab8 ^ 0xcab8) != 0)`) that is always false, likely inserted by an obfuscator or bug. This destroys clarity of intent and reading flow. The `process_rhs` method is moderately complex due to tuple manipulation in one line, reducing action granularity. Nesting is shallow, which is good, but the class lacks docstrings or comments explaining the IExact lookup purpose. Code length is acceptable, but the misleading condition makes it feel longer than necessary. Structure is logical, but the dead code and compressed operations make it hard to trust or understand quickly. Overall, readable only to someone already familiar with Django internals.

Run 1

1. Code Structure: Imports and a small lookup class are logically organized, though many imports are unused in this snippet and BuiltinLookup is not defined or imported here. 2. Nesting: Shallow conditionals keep the method easy to follow. 3. Clarity of intent: The lookup name and preparation call convey case-insensitive matching, but the hexadecimal XOR condition is opaque and always false, making its assertion unnecessary and distracting. 4. Code length: The method is concise, but the dead assertion block and extensive imports add clutter. 5. Action granularity: Each line generally performs one clear action, with straightforward unpacking and parameter reconstruction. 6. Reading flow: Processing the right-hand side, adjusting parameters, and returning results follows a natural sequence, interrupted by the meaningless initial guard.

Run 2

Code Structure: The lookup class is logically organized, but numerous unused imports distract from its small implementation, and BuiltinLookup is not defined or imported in the snippet. Nesting: Shallow conditionals keep the method easy to follow. Clarity of intent: The class name, lookup_name, and preparation call indicate a case-insensitive exact lookup, but the hexadecimal XOR condition is always false and introduces confusing, unreachable assertion code. Code length: The actual lookup logic is concise; the import block and dead conditional add unnecessary length. Action granularity: Most lines perform one action, though tuple reconstruction combines transformation and unpacking. Reading flow: Processing the parent result, preparing the first parameter, and returning the result forms a natural sequence, interrupted by the unexplained assertion guard.

Run 3

Code Structure: The lookup class and method are logically organized, but numerous unused imports clutter the snippet, and BuiltinLookup is not defined or imported here. Nesting: Shallow conditionals keep the method easy to follow. Clarity of intent: The lookup name and prep_for_iexact_query call communicate case-insensitive parameter preparation, but the always-false XOR condition and unreachable assertion are unexplained distractions. Code length: The method is concise, although the redundant assertion block and unused imports add unnecessary length. Action granularity: Statements generally perform one clear action per line; the tuple reconstruction is compact and understandable. Reading flow: The superclass call, conditional parameter preparation, and return form a natural sequence, interrupted by the pointless initial guard.