Sample

pyint-99a4b85217f3-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines32

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8280–1; higher is more readable
Mi0.1820–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro80–20; mean of three runs
GPT-6.1 Sol13.670–20; mean of three runs
BTTF0.450–1; higher is more readable

Views

Source code

from django.core.exceptions import FieldError, FullResultSet from django.db.models.expressions import Col from django.db.models.sql.compiler import SQLAggregateCompiler, SQLCompiler from django.db.models.sql.compiler import SQLDeleteCompiler as BaseSQLDeleteCompiler from django.db.models.sql.compiler import SQLInsertCompiler from django.db.models.sql.compiler import SQLUpdateCompiler as BaseSQLUpdateCompiler class SQLDeleteCompiler(BaseSQLDeleteCompiler): def delete(self): # Prefer the non-standard DELETE FROM syntax over the SQL generated by # the SQLDeleteCompiler's default implementation when multiple tables # are involved since MySQL/MariaDB will generate a more efficient query # plan than when using a subquery. token, record, balance = self.query.where.split_having_qualify( must_group_by=self.query.group_by is not None ) if self.single_alias or record or balance: # DELETE FROM cannot be used when filtering against aggregates or # window functions as it doesn't allow for GROUP BY/HAVING clauses # and the subquery wrapping (necessary to emulate QUALIFY). return super().as_sql() region = ["DELETE %s FROM" % self.quote_name(self.query.get_initial_alias())] duration, source = self.get_from_clause() region.extend(duration) try: localItem, pendingEvent = self.compile(token) except FullResultSet: pass else: region.append("WHERE %s" % localItem) source.extend(pendingEvent) return " ".join(region), tuple(source)

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.1260.698−41.603
Source linesThe number of non-empty source lines.32+12.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.719−7.079

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.85+0.567
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.052+0.435
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.33−0.132
Indentation frequencyHow rapidly indentation changes from line to line.25+0.128
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.84.939+0.068
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.31.837+0.035

Intercept 0.07 + feature contributions = 1.569 (log-odds).
Score = sigmoid(1.569) = 0.828.

Score0.182
Score20
Run 1

The code is difficult to read due to deeply nested logic, unclear variable names, and inconsistent naming conventions. The comments do not clarify variable purposes. The `delete` method mixes multiple responsibilities (clause splitting, SQL generation, exception handling) in one block. Variable names like `token`, `record`, `balance`, `region`, `duration`, `source`, `localItem`, and `pendingEvent` obscure intent. The exception handling flow disrupts natural reading. The overall structure lacks modularity and clear separation of concerns.

Run 2

The code has a clear structure and follows Django compiler conventions, but readability is reduced by unclear variable names. Names like 'token', 'record', 'balance', 'duration', 'source', 'region', 'localItem', and 'pendingEvent' obscure the intent—these appear to be placeholders or obfuscated names that don't reflect their actual purpose (e.g., 'duration' likely represents FROM clause SQL fragments). The nesting level is low, which is good, and the control flow is straightforward. However, the try/except/else pattern adds cognitive overhead, and the comment partially explains the logic but doesn't clarify the variable roles. The code is concise and maintains one action per line, but the reading flow suffers because the domain logic is not immediately apparent due to poor naming. Action granularity is adequate, and the overall organization aligns with Django's SQL compiler patterns, but the intent remains ambiguous without additional context.

Run 3

The code has a clear purpose but suffers from poor readability due to cryptic variable names (region, duration, source, token, localItem, pendingEvent) that obscure their roles. The single delete() method mixes multiple responsibilities: constructing SQL fragments, handling exceptions, and managing tuple parameters. Nesting is shallow, which is good, but the flow is disjointed—variables are built incrementally with side effects (source.extend) inside an except/else block, making the final return value hard to trace. Comments help explain the 'why' but not the 'what' of variable names. Action granularity is generally one per line, yet lines like tuple(source) and the assignment of localItem, pendingEvent compress multiple actions. The code lacks helper methods to isolate WHERE compilation and FROM clause handling. Overall, it requires careful reading to understand the SQL assembly logic and data flow.

Run 1

Code Structure: The method is logically organized into eligibility checks, SQL construction, condition compilation, and return. Nesting: Shallow nesting and an early return keep control flow manageable; the try/except/else adds modest complexity. Clarity of intent: Detailed comments explain the optimization and SQL limitations, but unrelated names such as token, record, balance, region, duration, and pendingEvent obscure what the values represent. Mixed naming styles also reduce consistency. Code length: The implementation is concise, although several imports are unused in this snippet. Action granularity: Statements generally perform one action per line; tuple unpacking groups related results appropriately. Reading flow: Execution proceeds naturally from checks to query assembly, but understanding the misleading variable names and inherited compiler behavior requires additional effort.

Run 2

Code Structure: The method is logically organized into eligibility checks, SQL construction, condition compilation, and return, though several imports appear unused. Nesting: Shallow nesting and an early return keep complexity manageable. Clarity of intent: Explanatory comments clearly justify the specialized DELETE syntax, but arbitrary names such as token, record, balance, region, duration, localItem, and pendingEvent obscure their SQL roles. Code length: The implementation is reasonably concise without excessive abstraction. Action granularity: Most lines perform one operation; tuple unpacking naturally groups related results. Reading flow: Execution proceeds naturally, but inconsistent naming styles and the empty FullResultSet handler require additional interpretation.

Run 3

Code Structure: Imports and a focused compiler subclass provide logical organization, although several imports are unused. Nesting: Shallow control flow and an early return keep complexity manageable. Clarity of intent: Detailed comments explain the SQL optimization and limitations, but names such as token, record, balance, region, duration, and pendingEvent obscure their actual roles. The method name delete also contrasts with its SQL-generation behavior and delegation to as_sql. Code length: The implementation is compact without excessive fragmentation; comments are useful rather than redundant. Action granularity: Most lines perform one operation, and tuple unpacking is reasonable. Reading flow: The progression from eligibility checks through query construction to return is natural, but misleading variable names and mixed naming conventions repeatedly interrupt comprehension.