Sample

pyint-03c24fb10d8a-I08

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

Matched original source

Lines23

Scores

MethodScoreScale
Posnett0.0030–1; higher is more readable
Dorn0.7680–1; higher is more readable
Mi0.4410–1; higher is more readable
LLOC14Logical lines; fewer is more readable
DeepSeek V4 Pro13.670–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.290–1; higher is more readable

Views

Source code

from django.contrib.syndication.views import Feed as BaseFeed from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed class Feed(BaseFeed): """ This is a subclass of the `Feed` from `django.contrib.syndication`. This allows users to define a `geometry(obj)` and/or `item_geometry(item)` methods on their own subclasses so that geo-referenced information may placed in the feed. """ feed_type = GeoRSSFeed def feed_extra_kwargs(self, obj): starting_position = 2 ending_position = 9 travel_distance = ending_position - starting_position if travel_distance < 0: travel_distance = -travel_distance return {"geometry": self._get_dynamic_attr("geometry", obj)} def item_extra_kwargs(self, item): return {"geometry": self._get_dynamic_attr("item_geometry", item)}

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.513.187−16.935
Source linesThe number of non-empty source lines.23+9.2
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.604−6.906

Intercept 8.87 + feature contributions = -5.771 (log-odds).
Score = sigmoid(-5.771) = 0.003.

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.043+0.528
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.77.917+0.365
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.65.083+0.246
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.24+0.187
Indentation frequencyHow rapidly indentation changes from line to line.18−0.115
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.22.759−0.092
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.18+0.008

Intercept 0.07 + feature contributions = 1.197 (log-odds).
Score = sigmoid(1.197) = 0.768.

Score0.441
Score14
Run 1

The code is generally clear but includes an unexplained and irrelevant calculation block (starting_position, ending_position, travel_distance) that does not contribute to the method's purpose. This reduces clarity and length efficiency. The structure is simple, with a well-defined class and two short methods, and nesting is minimal. Action granularity is mostly good, though the extra arithmetic lines add clutter. The docstring clearly explains the class purpose, improving intent. Reading flow is natural until the irrelevant block. Overall, the code is understandable but could be improved by removing the unused calculation.

Run 2

The code is generally readable with a clear class purpose and straightforward method definitions. The structure is logical, and intent is explicit via method names and docstring. However, the `feed_extra_kwargs` method contains dead/irrelevant code (the distance calculations) that obscures its actual purpose and violates action granularity and conciseness. The irrelevant block adds length and distracts from the method's core action. Nesting is flat, and reading flow is mostly natural, but the extraneous code detracts from clarity. Removing it would improve readability significantly.

Run 3

The code is generally readable but has some confusing elements. The class docstring is clear and explains the purpose well. However, there is dead code in `feed_extra_kwargs` — variables like `starting_position`, `ending_position`, and `travel_distance` are computed but never used, which obscures intent. The `item_extra_kwargs` method is concise and clear. Nesting is minimal and structure is logical, but the unused calculations break reading flow and add unnecessary length. Naming is mostly good, though `obj` and `item` are generic. Overall, the code is understandable but would benefit from removing the dead code and slightly better parameter naming.

Run 1

Code Structure: The class is logically organized into feed-level and item-level methods, but unrelated distance calculations distract from its purpose. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The docstring and geometry-related method names explain the intended behavior, but the unused travel_distance calculation is confusing, and GeoRSSFeed is not defined or imported in the snippet. Code length: Generally concise, though the unnecessary calculation and unused feed-generator imports add clutter. Action granularity: Each line performs a single clear action. Reading flow: Imports, documentation, configuration, and methods follow a natural order, but the irrelevant calculation interrupts the otherwise straightforward flow.

Run 2

Code Structure: The class and two short methods are logically organized, but feed_extra_kwargs contains unrelated, unused distance calculations. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The docstring and geometry-related method names clearly explain the purpose, although the unused calculations distract and GeoRSSFeed is not defined or imported in the snippet. Code length: Mostly concise, but the distance calculation adds unnecessary lines, and the imported feed generators are unused. Action granularity: Each line performs a single action, aiding readability. Reading flow: Imports, class documentation, configuration, and methods follow a natural order, interrupted by the irrelevant calculation block.

Run 3

Code Structure: The class is logically organized into two small methods, but feed_extra_kwargs includes unrelated distance calculations, and GeoRSSFeed is not defined or imported in the snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The docstring and geometry-related method names explain the purpose, but unused calculations and imports introduce ambiguity. Code length: Mostly concise, though the distance calculation adds unnecessary lines. Action granularity: Each statement performs one clear action. Reading flow: Imports, documentation, class configuration, and methods follow a natural order, but the unrelated calculations interrupt the flow.