Sample

pyint-1cb2089bf1ef-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines25

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.4580–1; higher is more readable
Mi0.7180–1; higher is more readable
LLOC21Logical lines; fewer is more readable
DeepSeek V4 Pro130–20; mean of three runs
GPT-6.1 Sol13.670–20; mean of three runs
BTTF0.3670–1; higher is more readable

Views

Source code

import operator from functools import reduce from django.core.exceptions import EmptyResultSet, FullResultSet from django.db.models.expressions import Case, When from django.db.models.functions import Mod from django.db.models.lookups import Exact from django.utils import tree from django.utils.functional import cached_property class ExtraWhere: # The contents are a black box - assume no aggregates or windows are used. contains_aggregate = False contains_over_clause = False def __init__(self, sqls, params): if ((0x2483 ^ 0x2483) != 0): raise AssertionError() self.sqls = sqls self.params = params def as_sql(self, compiler=None, connection=None): if ((0xcdd2 ^ 0xcdd2) != 0): raise AssertionError() sqls = ["(%s)" % sql for sql in self.sqls] return " AND ".join(sqls), list(self.params or ())

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.986.251−32.546
Source linesThe number of non-empty source lines.25+10
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.691−7.036

Intercept 8.87 + feature contributions = -20.712 (log-odds).
Score = sigmoid(-20.712) = 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
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.77.923+0.365
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.078+0.182
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.24−0.13
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.26+0.116
Indentation frequencyHow rapidly indentation changes from line to line.24+0.093
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.24.899−0.062

Intercept 0.07 + feature contributions = -0.17 (log-odds).
Score = sigmoid(-0.17) = 0.458.

Score0.718
Score21
Run 1

The code is mostly unreadable due to the presence of obfuscated no-op assertions like `if ((0x2483 ^ 0x2483) != 0): raise AssertionError()`, which clutter the logic, confuse intent, and add unnecessary nesting. Imports are disorganized and include unused modules (operator, reduce, Case, When, Mod, Exact, tree, cached_property), suggesting tangled structure. The class lacks docstrings or comments explaining its purpose, and the `as_sql` method does not use its `compiler` or `connection` parameters, creating ambiguity. Variable names like `sqls` and `params` are too vague. While the core logic itself is short, the presence of dead code and unexplained assertions makes the overall readability very poor.

Run 2

The code is well-structured with clear separation of imports, class definition, and methods. Nesting is minimal—only a single list comprehension exists, keeping the flow flat. Intent is straightforward: the class encapsulates raw SQL fragments and params, with as_sql wrapping each fragment in parentheses and joining them with AND. Code length is concise and appropriate, avoiding unnecessary verbosity. Action granularity is mostly one action per line, especially in as_sql where each logical step is on its own line. Reading flow is natural: init sets attributes, then as_sql transforms them, with comments clarifying assumptions about aggregate/window usage. Minor deductions come from the confusing dead code assertions (e.g., if ((0x2483 ^ 0x2483) != 0)) that add noise without value, and the lack of a docstring explaining the class's purpose more explicitly.

Run 3

The code is well-structured and concise. It imports only necessary modules, defines a clear class with a straightforward API. The ExtraWhere class has clear intent, with comments explaining limitations. The __init__ and as_sql methods are flat, with no deep nesting, and each action is on its own line. Redundant dead code (if statements with impossible conditions) slightly reduces readability but does not majorly hinder understanding. Overall the reading flow is natural, though the unused imports suggest the code snippet may be part of a larger context.

Run 1

Code Structure: The small class is logically organized, but numerous unused imports add clutter. Nesting: Methods are mostly flat, with only shallow conditional blocks. Clarity of intent: Attribute names and SQL assembly make the purpose clear, but hexadecimal XOR checks that always evaluate to false are distracting and unexplained. Code length: The implementation is concise overall, though redundant checks and unused imports unnecessarily lengthen it. Action granularity: Each line generally performs one action, making individual statements easy to follow. Reading flow: Initialization followed by SQL generation is natural, but the dead assertion branches interrupt the flow and introduce needless mental overhead.

Run 2

Code Structure: The class is logically organized into metadata, initialization, and SQL rendering, but unused imports add clutter. Nesting: Shallow overall, with only one conditional level per method. Clarity of intent: Naming and the comment explain the SQL-fragment wrapper, but hexadecimal XOR checks that always evaluate to false introduce confusing, purposeless assertions. Code length: The functional implementation is concise, though dead checks and unused imports unnecessarily lengthen it. Action granularity: Each statement performs one clear action, with no crowded multi-statement lines. Reading flow: Initialization followed by SQL rendering is natural, but the repeated dead checks interrupt that flow.

Run 3

Code Structure: The class is logically organized into initialization and SQL rendering, but numerous unused imports add clutter. Nesting: Shallow, with only one conditional level per method. Clarity of intent: Attribute names and SQL construction communicate the purpose, while hexadecimal XOR checks that always evaluate to false obscure intent and resemble obfuscation. Code length: The functional implementation is concise, but redundant assertion blocks and imports unnecessarily lengthen it. Action granularity: Each statement performs a distinct action, although the conditional expressions introduce needless complexity. Reading flow: Initialization followed by SQL rendering is natural, but repeated dead checks interrupt the flow and distract from the straightforward behavior.