Sample

pyint-74323d253e10-I01

Remove comments and docstrings

Matched original source

Lines21

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7260–1; higher is more readable
Mi0.4880–1; higher is more readable
LLOC17Logical lines; fewer is more readable
DeepSeek V4 Pro15.330–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.5720–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: contains_aggregate = False contains_over_clause = False def __init__(self, sqls, params): self.sqls = sqls self.params = params def as_sql(self, compiler=None, connection=None): 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.780.484−25.756
Source linesThe number of non-empty source lines.21+8.4
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.638−6.957

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

Feature contributions

FeatureValueContribution
(log-odds)
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.63.909+0.958
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
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.22+0.257
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.074+0.225
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.20.862−0.118
Indentation frequencyHow rapidly indentation changes from line to line.21−0.011

Intercept 0.07 + feature contributions = 0.976 (log-odds).
Score = sigmoid(0.976) = 0.726.

Score0.488
Score17
Run 1

The code is generally readable with clear structure and intent. It defines a simple class with an as_sql method that combines SQL snippets into an AND-joined expression, which is easy to follow. Nesting is minimal, action granularity is appropriate, and the logic is not tangled. However, some unused imports (operator, reduce, EmptyResultSet, FullResultSet, Case, When, Mod, Exact, tree, cached_property) add noise—they don't hurt functionality but reduce clarity and could mislead maintainers about dependencies. The method signature includes compiler and connection parameters that are not used, which slightly obscures intent. Concise and straightforward overall, but removing dead imports would improve readability.

Run 2

The code is mostly readable with clear structure and intent. It defines a simple class for handling extra SQL WHERE clauses with straightforward initialization and SQL generation logic. The imports are mostly unused (operator, reduce, Case, When, Mod, Exact, tree, cached_property), which adds minor clutter. The class methods are flat with minimal nesting, and action granularity is appropriate—one logical operation per line. The reading flow is natural, moving from imports to class definition to methods. However, the unused imports reduce clarity and suggest incomplete cleanup, and the class name 'ExtraWhere' is slightly ambiguous without context. The as_sql method's purpose is clear though the compiler/connection parameters are unused, which may confuse readers about the interface contract. Overall, it's concise and readable but could be tighter with import cleanup.

Run 3

The code is a Django-related SQL fragment wrapper with clear intent (joining WHERE clauses with AND). Structure is logical but includes unused imports (operator, reduce, Case, When, etc.), suggesting copy-paste or incomplete refactoring. Nesting is flat and readability is good. The as_sql method is concise and does one conceptual task, though the two-line return could be split for clarity. The class has minimal attributes and a simple interface. Overall it is easy to follow, but the unused imports and lack of docstrings reduce clarity about where this class is intended to be used.

Run 1

Code Structure: The class is logically organized, with metadata flags, initialization, and SQL rendering clearly separated. Nesting: The code is flat, with only a straightforward list comprehension. Clarity of intent: Class and method names communicate their purpose, although the metadata flags and unused compiler/connection parameters require framework context. Code length: The implementation is concise, but the many unused imports add unnecessary clutter to this snippet. Action granularity: Each statement performs one clear action; the return expression compactly combines two related outputs without becoming difficult to read. Reading flow: The progression from stored inputs to parenthesized SQL fragments and joined output is natural. Minor whitespace inconsistencies slightly reduce polish.

Run 2

Code Structure: The class is logically organized, with metadata flags, initialization, and SQL rendering clearly separated. Nesting: The code is flat, with no complex control flow. Clarity of intent: Class and method names communicate SQL-condition handling, although the flags and unused method parameters lack explanatory context. Code length: The implementation is concise, but numerous unused imports add clutter. Action granularity: Each statement performs a focused action; the return statement naturally pairs SQL with its parameters. Reading flow: Initialization followed by rendering is easy to follow. Minor formatting issues, including whitespace on a blank line and insufficient separation before the class, slightly reduce polish.

Run 3

Code Structure: The small class cleanly separates initialization from SQL rendering, although several unused imports add clutter. Nesting: The code is flat, with only a straightforward list comprehension. Clarity of intent: Attribute names and as_sql() clearly communicate SQL fragment construction, though ExtraWhere is somewhat generic and the compiler and connection parameters are unused. Code length: The implementation is concise without unnecessary logic. Action granularity: Each line performs one clear assignment or operation; the return combines closely related output construction appropriately. Reading flow: The class reads naturally from capability flags to stored inputs to SQL output. Minor whitespace inconsistencies and unused imports slightly reduce readability.