Sample

pyint-39dfda29486e-I01

Remove comments and docstrings

Matched original source

Lines32

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.5520–1; higher is more readable
Mi0.2650–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro130–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.4790–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 as_sql(self): where, having, qualify = self.query.where.split_having_qualify( must_group_by=self.query.group_by is not None ) if self.single_alias or having or qualify: return super().as_sql() result = ["DELETE %s FROM" % self.quote_name(self.query.get_initial_alias())] from_sql, params = self.get_from_clause() result.extend(from_sql) try: where_sql, where_params = self.compile(where) except FullResultSet: pass else: result.append("WHERE %s" % where_sql) params.extend(where_params) return " ".join(result), tuple(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.1252.248−41.324
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.554−6.831

Intercept 8.87 + feature contributions = -26.485 (log-odds).
Score = sigmoid(-26.485) = 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
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Indentation frequencyHow rapidly indentation changes from line to line.32+0.37
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.076+0.206
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.33−0.132
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 = 0.21 (log-odds).
Score = sigmoid(0.21) = 0.552.

Score0.265
Score20
Run 1

The code has a clear purpose—customizing SQL DELETE compilation—but readability suffers from several issues. The structure is logical but not immediately apparent due to blank lines that suggest missing logic or placeholders. Nesting is shallow, which is good, but the action granularity is inconsistent: some lines handle multiple operations (e.g., calling split_having_qualify and checking conditions) while others are simple. The reading flow is disrupted by unexplained blank lines and the absence of comments explaining the branching condition (single_alias, having, or qualify). The try/except FullResultSet block is concise but could be clearer if its intent were documented. Overall, the code is understandable for developers familiar with Django internals, but the ambiguous empty spaces and terse logic reduce clarity.

Run 2

The code is moderately readable but has several issues. The class structure and imports are logical, and the method name clearly indicates its purpose. However, the method contains multiple blank lines and inline comments that suggest unclear intent. Nesting is flat, which is good, but the logic flow is somewhat disjointed—especially the try/except/else construct, which obscures the primary path. The code is reasonably concise, though the try/except/else could be simplified. Action granularity is mixed: some lines do one logical thing, while others (like the append and extend) combine multiple operations. Reading flow is disrupted by the excessive blank lines and the abrupt return in the middle. The overall purpose—handling DELETE SQL generation—is evident, but the implementation could be clearer.

Run 3

The code is generally clear and concise, with a single-purpose method that has a logical structure. It uses flat nesting, though the try/except/else and list-building add moderate complexity. Variable names are descriptive, and actions are mostly one per line. Unlabeled blank-line blocks and conditional paths slightly reduce clarity, but overall the intent—constructing a DELETE SQL statement—is understandable and the flow is fairly readable.

Run 1

Code Structure: The method is logically organized into query analysis, fallback handling, SQL construction, and return, though several unused imports add clutter. Nesting: Shallow conditionals and a single try/except/else keep complexity low. Clarity of intent: Descriptive compiler and variable names communicate DELETE SQL generation, but the fallback conditions and silent FullResultSet handling require Django-specific knowledge. Code length: The implementation is concise, although excessive whitespace unnecessarily stretches it. Action granularity: Statements generally perform one action per line, with readable multiline calls. Reading flow: Execution proceeds naturally from validation to clause assembly, but large blank gaps interrupt the flow.

Run 2

Code Structure: The method is logically organized into query-condition analysis, fallback handling, SQL construction, and return. Nesting: Shallow nesting and an early return keep control flow manageable. Clarity of intent: Descriptive names and familiar compiler methods communicate the purpose, though the fallback condition and silent FullResultSet handling require Django-specific knowledge. Code length: The implementation is concise, but excessive blank lines add visual clutter, and several imports are unused in this snippet. Action granularity: Each statement performs one clear action, with tuple unpacking naturally grouping related values. Reading flow: Execution follows a sensible top-to-bottom sequence, although unexplained exception handling and irregular whitespace slightly interrupt readability.

Run 3

Code Structure: The method is logically organized into condition analysis, fallback handling, SQL assembly, and return. Nesting: Shallow nesting and an early return keep control flow manageable. Clarity of intent: Descriptive compiler and SQL-related names convey the purpose, but the fallback conditions and silent FullResultSet handling require Django knowledge; brief comments would clarify them. Code length: The implementation is concise, though repeated whitespace-only lines add unnecessary visual clutter. Action granularity: Statements generally perform one action per line, with straightforward unpacking and list operations. Reading flow: SQL construction follows a natural sequence, but excessive blank lines interrupt it, and several imports are unused in the shown snippet.