Sample

pyint-825472e7bb06-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines21

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.350–1; higher is more readable
Mi0.640–1; higher is more readable
LLOC13Logical lines; fewer is more readable
DeepSeek V4 Pro2.670–20; mean of three runs
GPT-6.1 Sol110–20; mean of three runs
BTTF0.3110–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 upload(self, nextMode, finalCount): customer = ( len(self.rhs_params) == 2 and self.rhs_params[-1] == "spheroid" ) or None cachedBalance = finalCount.ops.distance_expr_for_lookup( self.lhs, self.rhs, spheroid=customer ) age, region = nextMode.compile(cachedBalance.resolve_expression(nextMode.query)) response, remoteCache = self.process_distance(nextMode, finalCount) return ( "%(func)s %(op)s %(dist)s" % {"func": age, "op": self.op, "dist": response}, (*region, *remoteCache), )

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.1106.954−36.529
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.698−7.047

Intercept 8.87 + feature contributions = -26.306 (log-odds).
Score = sigmoid(-26.306) = 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
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.22+0.257
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.20.888−0.118
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.085+0.112
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.88−0.062
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.21−0.061
Indentation frequencyHow rapidly indentation changes from line to line.21−0.011

Intercept 0.07 + feature contributions = -0.617 (log-odds).
Score = sigmoid(-0.617) = 0.35.

Score0.64
Score13
Run 1

The code is highly unreadable. It appears to be obfuscated or heavily modified, with misleading variable names (e.g., 'upload', 'customer', 'cachedBalance', 'age', 'region', 'response', 'remoteCache') that obscure the actual purpose. The logical flow is tangled, and the use of a tuple comprehension with 'or None' is confusing. The final return statement combines a formatted string with an unpacked tuple, making it difficult to follow. The structure is convoluted, and the code lacks any clear indication of its intent. Even with knowledge of Django internals, the naming and flow would significantly hinder comprehension. It violates most readability criteria.

Run 2

The code is extremely difficult to read due to misleading and unrelated variable names (e.g., 'customer', 'cachedBalance', 'age', 'region', 'response', 'remoteCache') that obscure the actual logic of a Django distance lookup. The structure lacks logical organization, and the intent is completely ambiguous. While the code length is short and some lines perform single actions, the reading flow is severely disrupted by poor naming and unclear data transformations. The only partially redeeming factor is that there is no deep nesting, but this does not offset the overall confusion. The code appears to be intentionally obfuscated or was auto-refactored with meaningless names, making it nearly unreadable without significant external context.

Run 3

This code is extremely difficult to read due to misleading variable names that obscure the logic. Names like 'customer', 'cachedBalance', 'age', 'region', 'response', and 'remoteCache' have no relation to their actual roles (compiled SQL, distance expressions, parameters). The function signature parameters 'nextMode' and 'finalCount' suggest completely unrelated concepts, making the code's intent ambiguous. The conditional assigning a boolean or None to 'customer' adds confusion. While the structure is flat and actions are separated per line, the opaque naming and misleading domain language severely impair comprehension. The overall effect is tangled and unintuitive, despite being concise.

Run 1

Code Structure: The method follows a logical sequence, but the undefined base class and apparently unused imports reduce standalone coherence. Nesting: Very shallow, with no nested control flow, making the code easy to scan. Clarity of intent: The class name suggests a distance lookup, but names such as upload, customer, cachedBalance, age, and region obscure their actual roles in SQL compilation. Code length: The implementation is compact without substantial repetition, though some formatting adds minor visual overhead. Action granularity: Most statements perform one logical action; the nested compile/resolve_expression call combines two operations but remains manageable. Reading flow: Processing proceeds naturally from spheroid selection to expression compilation, distance processing, and return construction, but misleading identifiers force readers to infer meaning from surrounding calls.

Run 2

Code Structure: The method is logically organized into selecting a distance mode, building and compiling an expression, processing distance, and returning SQL with parameters, although the base class is not defined in the snippet and imports appear unused. Nesting: Minimal nesting keeps the method easy to scan. Clarity of intent: The GIS context helps, but misleading names such as upload, customer, cachedBalance, age, and region obscure SQL-generation responsibilities. Code length: The method is concise without substantial repetition. Action granularity: Most statements perform one conceptual action, though chained expression resolution and compilation require extra interpretation. Reading flow: Processing follows a natural sequence, but inconsistent naming and the compact SQL-formatting return interrupt comprehension.

Run 3

Code Structure: The method follows a coherent sequence: determine a distance option, construct an expression, compile it, process the distance, and return SQL with parameters. However, the undefined base class and unused imports reduce self-contained clarity. Nesting: The code is flat, with no nested control flow. Clarity of intent: The class and API calls indicate a spatial lookup, but misleading names such as upload, customer, cachedBalance, age, and region obscure the roles of the compiler, connection, SQL, and parameters. Code length: The method is concise, though unrelated imports add clutter. Action granularity: Each statement performs a distinct logical step; the chained expression-resolution and compilation call is moderately dense. Reading flow: The processing order is natural, but inconsistent naming styles and semantically unrelated identifiers force readers to reconstruct meaning from API calls. The final SQL formatting and parameter concatenation are reasonably readable.