Sample

pyint-ea2431e8e74a-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines44

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8450–1; higher is more readable
Mi0.5260–1; higher is more readable
LLOC23Logical lines; fewer is more readable
DeepSeek V4 Pro140–20; mean of three runs
GPT-6.1 Sol14.330–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 organize(self, group, reference, schedule): if not isinstance(group, LexemeCombinable): raise TypeError( "A Lexeme can only be combined with another Lexeme, " f"got {group.__class__.__name__}." ) if schedule: return CombinedLexeme(group, reference, self) return CombinedLexeme(self, reference, group) # On Combinable, these are not implemented to reduce confusion with Q. In # this case we are actually (ab)using them to do logical combination so # it's consistent with other usage in Django. def __or__(self, value): return self.organize(value, self.BITOR, False) def __ror__(self, score): return self.organize(score, self.BITOR, True) def __and__(self, index): return self.organize(index, self.BITAND, False) def __rand__(self, cache): return self.organize(cache, 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.1290−42.57
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.666−6.999

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

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.41+0.681
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.86.911+0.598
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.064+0.317
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 = 1.693 (log-odds).
Score = sigmoid(1.693) = 0.845.

Score0.526
Score23
Run 1

The code is moderately readable but has significant issues. The class structure and method organization are logical, and the overall flow is understandable. However, the parameter naming is confusing and inconsistent: 'group', 'reference', 'schedule', 'score', 'index', and 'cache' don't reflect their actual roles (value, operator, order flag). This makes the intent ambiguous. The 'organize' method name is vague - it's actually combining lexemes. The nesting is acceptable with only one conditional block, and action granularity is reasonable at one action per line. The method implementations are concise but the parameter naming obscures the logic. The comment explains the unusual operator overloading, which helps. Code length is appropriate. Reading flow suffers from the misleading parameter names that force readers to trace through method calls to understand what each argument represents. The 'schedule' parameter (boolean flag) controls ordering but its name gives no hint of this function.

Run 2

The code has clear structure with logical class organization and consistent method formatting. Nesting is minimal (one level in organize). However, clarity of intent is poor due to misleading parameter names: 'group', 'reference', 'schedule', 'score', 'index', 'cache' bear no relation to their actual roles (other lexeme, operator, operand order). This significantly obscures meaning. Code length is appropriate, and action granularity is good with one operation per line. Reading flow is disrupted by the parameter naming mismatch and the somewhat cryptic comment about 'abusing' logical operators. The class hierarchy is understandable but could be improved with docstrings explaining the Lexeme combination semantics. Overall, the code is maintainable but requires mental mapping of poorly named variables to their actual semantic roles.

Run 3

The code has a clear structure with a single class and related methods, but readability suffers from misleading naming. Parameters like 'group', 'reference', 'schedule', 'score', 'index', and 'cache' obscure the actual purpose—these are lexeme operands, not schedules or caches. The `organize` method does two things: type-checking and conditional construction, reducing clarity. Nesting is minimal, but the boolean flag `schedule` is ambiguous without context. The dunder methods are concise but rely on cryptic argument names, making intent hard to follow. Action granularity is acceptable—one operation per line—but the logical flow is inverted by the boolean parameter. The docstring explains the unconventional use of bitwise operators, which helps. Overall, the code is functional but would benefit from clearer naming and a more explicit structure for building combined lexemes.

Run 1

Code Structure: The class logically groups combination logic and operator overloads, though numerous unused imports distract from this snippet. Nesting: Control flow is shallow, with straightforward validation and a single conditional. Clarity of intent: Operator names, constants, and the explanatory comment convey logical combination, but organize and parameters such as group, reference, schedule, score, index, and cache obscure their actual roles as operands, connector, and reversal flag. Code length: Methods are concise, and shared logic avoids repetition; the import section is disproportionately long for the displayed functionality. Action granularity: Each line generally performs one action, with readable multiline error construction. Reading flow: The progression from constants to shared logic to operator methods is natural, but inconsistent operand naming and unexplained positional boolean arguments interrupt comprehension.

Run 2

Code Structure: Imports, operator constants, shared combination logic, and operator overloads are logically organized. Nesting: Shallow conditionals and early returns make control flow easy to follow. Clarity of intent: Operator methods clearly support logical combinations, but organize and parameters such as group, reference, schedule, score, index, and cache obscure their actual roles as operands, connector, and reversal flag. The comment provides useful Django context. Code length: Concise, with repeated combination logic centralized in one helper. Action granularity: Each statement performs one clear action; multiline formatting keeps imports and the error message readable. Reading flow: The progression from constants to helper to overloads is natural, but inconsistent operand names and positional Boolean arguments interrupt comprehension.

Run 3

Code Structure: The class logically groups combination logic and operator overloads, though numerous unused imports clutter the snippet. Nesting: Shallow conditionals and an early exception keep control flow simple. Clarity of intent: Operator constants, CombinedLexeme, and the explanatory comment establish logical combination, but organize and parameter names such as group, reference, schedule, score, index, and cache obscure operand, operator, and reverse-order roles. Code length: The implementation is concise, with useful reuse of a shared helper rather than duplicated logic. Action granularity: Each statement performs a single clear action, and multiline formatting makes the exception readable. Reading flow: Constants followed by the helper and paired operator methods provide a natural progression, but inconsistent parameter naming adds unnecessary interpretation effort.