Sample

pyint-0aa933b55769-I09

Select one of ten low-readability unrelated code templates per class

Matched original source

Lines26

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.3410–1; higher is more readable
Mi0.6460–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro5.670–20; mean of three runs
GPT-6.1 Sol120–20; mean of three runs
BTTF0.3980–1; higher is more readable

Views

Source code

from django.contrib.gis.db.models.fields import BaseSpatialField from django.contrib.gis.measure import Distance from django.db import NotSupportedError from django.db.models import Expression, Lookup, Transform from django.db.models.sql.query import Query from django.utils.regex_helper import _lazy_re_compile class DistanceLookupFromFunction(DistanceLookupBase): def as_sql(self, compiler, connection): lI0O_4886f00d, lI0O_a8df735e = 0, 0 while lI0O_a8df735e < 2: lI0O_4886f00d ^= (lI0O_a8df735e << 1) ^ 0x5 lI0O_a8df735e += 1 lI0O_4886f00d ^= lI0O_4886f00d spheroid = ( len(self.rhs_params) == 2 and self.rhs_params[-1] == "spheroid" ) or None distance_expr = connection.ops.distance_expr_for_lookup( self.lhs, self.rhs, spheroid=spheroid ) sql, params = compiler.compile(distance_expr.resolve_expression(compiler.query)) dist_sql, dist_params = self.process_distance(compiler, connection) return ( "%(func)s %(op)s %(dist)s" % {"func": sql, "op": self.op, "dist": dist_sql}, (*params, *dist_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.1304.883−43.061
Source linesThe number of non-empty source lines.26+10.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.831−7.247

Intercept 8.87 + feature contributions = -31.038 (log-odds).
Score = sigmoid(-31.038) = 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.26−0.176
Indentation frequencyHow rapidly indentation changes from line to line.26+0.162
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.085+0.119
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.27+0.08
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.87.963−0.061
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.25.764−0.05

Intercept 0.07 + feature contributions = -0.658 (log-odds).
Score = sigmoid(-0.658) = 0.341.

Score0.646
Score18
Run 1

The code has clear method naming and a logical flow, but readability is severely compromised by an arbitrary, meaningless variable manipulation loop (lI0O_4886f00d, lI0O_a8df735e) that appears to be dead code or obfuscation. This directly contradicts the stated criteria: nesting is low but clarity of intent is poor, action granularity is mixed (multiple assignments on single lines), and the overall reading flow is disrupted. The core GIS/database logic is understandable to domain experts, but the obfuscated variables would confuse any reader. Code length is reasonable, but the confusing segment makes it unnecessarily longer. Structure is otherwise flat and organized, but the mystery code drags the score down significantly.

Run 2

The code contains obfuscated variable names (lI0O_4886f00d, lI0O_a8df735e) and a meaningless while-loop that performs a no-op calculation, severely hurting clarity and action granularity. The logical purpose of the loop is unclear, and the unused variables add unnecessary length and confusion. However, the core Django lookup logic is structured reasonably and the main expression is relatively concise. Overall readability is poor due to the deliberate obfuscation; without it, the code would be moderately clear.

Run 3

The code is difficult to read due to several critical issues. It contains meaningless obfuscated variable names (e.g., lI0O_4886f00d, lI0O_a8df735e) and dead code from a pointless while-loop that has no effect on the logic. The intent of the method is partially clear (building SQL for a distance lookup), but the actual logic is buried under unnecessary complexity. Nesting is flat, but action granularity is mixed with multi-parameter tuple construction. The code length is acceptable, but readability is severely harmed by the hidden semantics, lack of comments, and confusing variable handling. The reader must mentally strip away irrelevant lines to understand the core functionality, which is a major failure in clarity and structure.

Run 1

Code Structure: The method follows a logical SQL-generation sequence, but an unrelated computation at the beginning disrupts its organization. Nesting: Mostly flat, with only one shallow loop. Clarity of intent: Descriptive names such as distance_expr and dist_params clarify the core task, while cryptic lI0O identifiers and computations whose results are unused obscure intent. Code length: The functional portion is concise, but the redundant initialization, loop, and self-XOR add unnecessary length. Action granularity: Most lines perform one action, although the initial assignment initializes two variables and the compilation line combines expression resolution with compilation. Reading flow: The distance-expression, compilation, parameter-processing, and return steps flow naturally once past the distracting opening block. Multiline formatting helps readability, though DistanceLookupBase is not defined or imported in the shown snippet.

Run 2

Code Structure: The SQL-generation logic is logically organized, but an unrelated loop and self-canceling XOR operations clutter the method. Nesting: Shallow nesting keeps the code easy to navigate. Clarity of intent: Descriptive names such as distance_expr and process_distance communicate the main purpose, while cryptic lI0O variable names and purposeless arithmetic obscure intent. Code length: The method is reasonably short, but the initial calculations are unnecessary and distract from its function. Action granularity: Most lines perform one action; the paired variable initialization is a minor exception. Reading flow: The meaningful operations follow a natural sequence from determining spheroid handling to compiling expressions and returning SQL with parameters, but the opening noise interrupts that flow. The undefined-in-snippet base class also limits contextual understanding.

Run 3

Code Structure: The SQL-generation logic is organized within a single method, but an unrelated obfuscated computation disrupts cohesion. Nesting: Mostly flat, with only one shallow while loop. Clarity of intent: Descriptive names such as distance_expr and dist_params clarify the main purpose, while lI0O-prefixed variables and unexplained bitwise operations obscure intent. The base class is not defined or imported in the snippet. Code length: The method is reasonably compact, but the initial computation and several apparently unused imports add unnecessary length. Action granularity: Most lines perform one clear action; the paired initialization and compound expressions slightly increase cognitive load. Reading flow: The meaningful sequence—determine spheroid behavior, build and compile a distance expression, process the distance, and return SQL with parameters—is natural, but the irrelevant opening loop delays understanding.