Sample

pyint-1a54a1591d33-I01

Remove comments and docstrings

Matched original source

Lines44

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.5720–1; higher is more readable
Mi0.5810–1; higher is more readable
LLOC23Logical lines; fewer is more readable
DeepSeek V4 Pro170–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.4760–1; higher is more readable

Views

Source code

from django.db.backends.postgresql.psycopg_any import is_psycopg3 from django.db.models import ( CharField, Expression, Field, FloatField, Func, Lookup, TextField, Value, ) from django.db.models.expressions import CombinedExpression, register_combinable_fields from django.db.models.functions import Cast, Coalesce from django.utils.regex_helper import _lazy_re_compile from .utils import CheckPostgresInstalledMixin class LexemeCombinable: BITAND = "&" BITOR = "|" def _combine(self, other, connector, reversed): if not isinstance(other, LexemeCombinable): raise TypeError( "A Lexeme can only be combined with another Lexeme, " f"got {other.__class__.__name__}." ) if reversed: return CombinedLexeme(other, connector, self) return CombinedLexeme(self, connector, other) def __or__(self, other): return self._combine(other, self.BITOR, False) def __ror__(self, other): return self._combine(other, self.BITOR, True) def __and__(self, other): return self._combine(other, self.BITAND, False) def __rand__(self, other): return self._combine(other, self.BITAND, True)

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.1269.981−41.909
Source linesThe number of non-empty source lines.44+17.6
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.612−6.917

Intercept 8.87 + feature contributions = -22.357 (log-odds).
Score = sigmoid(-22.357) = 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.44+0.785
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.45−0.557
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.075+0.212
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.43.852+0.203
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.86.956−0.018

Intercept 0.07 + feature contributions = 0.289 (log-odds).
Score = sigmoid(0.289) = 0.572.

Score0.581
Score23
Run 1

The code is highly readable with clear structure and logical organization. The class hierarchy is simple, with a single class defining bitwise combination behavior for lexemes, and methods are short and focused. Nesting is minimal—type checking and conditional logic are handled succinctly without deep indentation. Intent is explicit: the `_combine` method centralizes validation and order handling, and operator overloads clearly map to bitwise AND/OR semantics. Action granularity is good, with each operation on its own line or logically grouped. Reading flow is natural—constants, helper method, then operator definitions. Minor deductions: the `reversed` parameter name shadows a built-in (though acceptable in this context), and the lack of docstrings slightly reduces immediate intent, but the code remains self-documenting. Overall, concise, flat, and well-structured.

Run 2

The code is highly readable with clear structure and purpose. It defines a LexemeCombinable class implementing bitwise operators for combining lexemes. The _combine method centralizes logic, reducing duplication across dunder methods. Nesting is minimal, with only one conditional check and no deep indentation. Intent is explicit: the class enables combining lexeme objects using Python's bitwise operators. Action granularity is good, with one logical action per line. The reading flow is natural, following a logical sequence: imports, class definition, constants, helper method, then operator overloads. Minor deductions: the repeated reversed/connector arguments in operator methods add slight boilerplate, and the type error message could be more concise, but these are negligible. Overall, the code is clean, maintainable, and follows Django conventions well.

Run 3

The code is highly readable with clear logical organization. The LexemeCombinable class is well-structured, with constants and a single helper method that centralizes combination logic, avoiding duplication. Nesting is minimal, and the intent is explicit—combining lexemes with bitwise operators. Lines are concise, each performing one action, and the reading flow is natural. The only minor deduction is the unusual blank lines before the operator methods, which slightly disrupt visual cohesion. Overall, it follows PEP 8 and Django conventions effectively.

Run 1

Code Structure: The class logically groups combination logic and operator overloads, though several imports are unused in this snippet. Nesting: Control flow is shallow, with simple validation and a single conditional. Clarity of intent: Descriptive method names, operator constants, and a helpful error message make the purpose clear; the boolean argument named 'reversed' slightly obscures calls and shadows a built-in. Code length: Methods are concise, but excessive blank lines add unnecessary visual space. Action granularity: Each statement performs one clear action. Reading flow: The shared helper followed by related operator methods creates a natural progression, with only minor formatting distractions.

Run 2

Code Structure: The class logically groups operator constants, a shared combination helper, and operator overloads; several unused imports and excessive blank lines add clutter. Nesting: Shallow conditionals keep control flow easy to follow. Clarity of intent: Descriptive class and method names, explicit type validation, and a helpful error message clarify behavior, though the 'reversed' parameter shadows a built-in and positional booleans require interpretation. Code length: The implementation is concise and avoids duplication through _combine, but imports are disproportionate to the shown functionality. Action granularity: Each line generally performs one clear action; the multiline error construction is readable. Reading flow: The helper followed by paired operator overloads creates a natural progression, interrupted slightly by unnecessary whitespace.

Run 3

Code Structure: Imports and the combinable class are logically organized, with shared combination logic centralized in _combine. Nesting: Shallow conditionals and early returns keep control flow simple. Clarity of intent: Descriptive class names, operator constants, and a clear error message communicate the purpose; the reversed parameter shadows a built-in, and CombinedLexeme is not defined in the excerpt. Code length: Methods are concise, although many imports are unused in the shown code and excessive blank lines add clutter. Action granularity: Each statement performs one clear action, with no compressed multi-statement lines. Reading flow: Validation, operand ordering, and operator wrappers follow a natural sequence, slightly disrupted by inconsistent spacing.