Sample

pyint-30a9da4f1617-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines44

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.840–1; higher is more readable
Mi0.530–1; higher is more readable
LLOC23Logical lines; fewer is more readable
DeepSeek V4 Pro15.330–20; mean of three runs
GPT-6.1 Sol15.330–20; mean of three runs
BTTF0.4540–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 com(self, oth, con, rev): if not isinstance(oth, LexemeCombinable): raise TypeError( "A Lexeme can only be combined with another Lexeme, " f"got {oth.__class__.__name__}." ) if rev: return CombinedLexeme(oth, con, self) return CombinedLexeme(self, con, oth) # 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, oth2): return self.com(oth2, self.BITOR, False) def __ror__(self, oth3): return self.com(oth3, self.BITOR, True) def __and__(self, oth4): return self.com(oth4, self.BITAND, False) def __rand__(self, oth5): return self.com(oth5, 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.684−7.026

Intercept 8.87 + feature contributions = -23.126 (log-odds).
Score = sigmoid(-23.126) = 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.068+0.284
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.43.909+0.204
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.978−0.019

Intercept 0.07 + feature contributions = 1.659 (log-odds).
Score = sigmoid(1.659) = 0.84.

Score0.53
Score23
Run 1

The code is structured logically and maintains a flat structure with minimal nesting. Each method performs a single clear action, and the reading flow is mostly natural. However, readability suffers from cryptic parameter names ('oth', 'con', 'rev', 'oth2'–'oth5') that obscure intent, and the 'com' method handles multiple responsibilities (type checking, operand ordering, object creation) in a compact but slightly dense way. The class-level operators are concise, but the numbered variations (oth2, oth3, etc.) feel arbitrary and force the reader to track position rather than meaning. Type checking logic inside 'com' adds reasonable clarity about expected types, but the overall lack of parameter descriptiveness reduces comprehension. The code is not overly long, but brevity comes at the cost of semantic clarity in names.

Run 2

The code is highly readable with clear logical organization. Class structure is clean, with the LexemeCombinable class containing related operators and a helper method. Nesting is minimal—only one level in the com method's conditional. Intent is clear: the class implements bitwise operator overloading for lexeme combination, with a helpful comment explaining the design choice. Code length is appropriately concise without being cryptic. Action granularity is good—each line performs one logical operation, though the combined arguments in __or__ etc. could be slightly clearer. Reading flow is natural: constants, helper method, then operator overloads in logical order. Minor deductions: single-letter variable names (oth2, oth3, etc.) and abbreviated method/parameter names (com, con, rev) slightly reduce clarity. The syntax error in the first import line (missing parentheses) would also need fixing.

Run 3

The code is generally readable with clear class structure and logical organization. Methods are short and focused, following single-action granularity. However, parameter naming (oth, oth2-5, con, rev) lacks clarity despite brevity, and the comment explains intent but could be clearer. The com method has moderate nesting with type checking, though error messages are helpful. Overall structure is flat and follows Django conventions, but abbreviated names reduce immediate comprehension.

Run 1

Code Structure: The class logically groups operator constants, a shared combination helper, and operator overloads, though many imports are unused in this snippet. Nesting: Minimal nesting makes control flow easy to follow. Clarity of intent: Type validation, the explanatory comment, and operator methods convey logical combination, but abbreviated names such as com, oth, con, and rev obscure meaning; inconsistent oth2–oth5 names add noise. Code length: The implementation is concise, with repetitive overloads appropriately delegating to one helper. Action granularity: Each line generally performs one action, and the multiline exception is readable. Reading flow: Validation followed by operand ordering and thin operator wrappers creates a natural progression, although clearer parameter names and better spacing between imports and the class would improve readability.

Run 2

Code Structure: The class logically groups combination logic and operator overloads, though numerous unused imports clutter the snippet. Nesting: Shallow conditionals and early returns keep control flow simple. Clarity of intent: LexemeCombinable, constants, the error message, and the explanatory comment communicate the purpose, but abbreviated names such as com, oth, con, and rev—and numbered variants oth2 through oth5—obscure meaning. Code length: The implementation is concise, with a shared helper avoiding duplication; the imports add unnecessary length in this snippet. Action granularity: Each statement performs one clear action, and multiline formatting is easy to scan. Reading flow: Constants, validation, combination construction, and operator wrappers follow a natural sequence, although clearer parameter names and standard spacing between imports and the class would improve readability.

Run 3

Code Structure: The class logically groups combination logic and operator overloads, though several imports are unused in this snippet. Nesting: Shallow conditionals and early returns keep complexity low. Clarity of intent: Class names, constants, the error message, and the explanatory comment communicate logical combination, but abbreviated names such as com, oth, con, and rev obscure meaning; numbered variants oth2–oth5 are distracting. Code length: Concise, with justified repetition for operator overloads. Action granularity: Each statement performs one clear action. Reading flow: The helper followed by operator methods provides a natural progression, although cryptic parameter names require readers to infer their roles.