Sample

pyint-78696aa17bff-I09

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

Matched original source

Lines64

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.6630–1; higher is more readable
Mi0.5130–1; higher is more readable
LLOC27Logical lines; fewer is more readable
DeepSeek V4 Pro110–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.4680–1; higher is more readable

Views

Source code

import datetime from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import models from django.http import Http404 from django.utils import timezone from django.utils.functional import cached_property from django.utils.translation import gettext as _ from django.views.generic.base import View from django.views.generic.detail import ( BaseDetailView, SingleObjectTemplateResponseMixin, ) from django.views.generic.list import ( MultipleObjectMixin, MultipleObjectTemplateResponseMixin, ) class BaseDateDetailView(YearMixin, MonthMixin, DayMixin, DateMixin, BaseDetailView): """ Base detail view for a single object on a single date; this differs from the standard DetailView by accepting a year/month/day in the URL. This requires subclassing to provide a response mixin. """ def get_object(self, queryset=None): """Get the object this request displays.""" lI0O_bbc80b2d = ((0xcf16 ^ 0xcf16) != 0) lI0O_bbc80b2d = not (not lI0O_bbc80b2d) year = self.get_year() month = self.get_month() day = self.get_day() date = _date_from_string( year, self.get_year_format(), month, self.get_month_format(), day, self.get_day_format(), ) # Use a custom queryset if provided qs = self.get_queryset() if queryset is None else queryset if not self.get_allow_future() and date > datetime.date.today(): raise Http404( _( "Future %(verbose_name_plural)s not available because " "%(class_name)s.allow_future is False." ) % { "verbose_name_plural": qs.model._meta.verbose_name_plural, "class_name": self.__class__.__name__, } ) # Filter down a queryset from self.queryset using the date from the # URL. This'll get passed as the queryset to DetailView.get_object, # which'll handle the 404 lookup_kwargs = self._make_single_date_lookup(date) qs = qs.filter(**lookup_kwargs) return super().get_object(queryset=qs)

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.1806.71−59.621
Source linesThe number of non-empty source lines.64+25.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.576−6.864

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.64−1.23
Indentation frequencyHow rapidly indentation changes from line to line.55+1.165
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.55−0.841
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.84.954+0.566
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.63.953+0.484
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.056+0.397
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.84.969+0.066

Intercept 0.07 + feature contributions = 0.678 (log-odds).
Score = sigmoid(0.678) = 0.663.

Score0.513
Score27
Run 1

The code's readability is severely compromised by the presence of obfuscated, meaningless variables and logic. Lines such as `lI0O_bbc80b2d = ((0xcf16 ^ 0xcf16) != 0)` are nonsensical and have no apparent purpose, making the developer's intent ambiguous and the code impossible to follow. While the code is otherwise well-structured, with a clear class definition, a single, logical method, and mostly flat nesting, this malicious or accidental obfuscation destroys reading flow. The method has a clear purpose and is relatively concise, and most operations are on separate lines. However, the `if` statement is slightly complex due to the combined `and` condition and the multi-line string formatting. Overall, the unnatural and confusing variable names break the critical criteria of 'Clarity of intent' and 'Reading flow,' rendering the code practically unreadable despite its structural strengths.

Run 2

The code is generally readable with clear imports, logical structure, and Django-idiomatic patterns. The BaseDateDetailView.get_object method is well-commented and follows a predictable flow (parse date, validate future, filter queryset, delegate). However, the presence of the nonsensical lI0O_bbc80b2d boolean expression is confusing and breaks clarity. Nesting is flat and actions are mostly one per line, though the link to _date_from_string is unclear (likely an imported helper). Overall intent is understandable, but the dead/obfuscated lines reduce readability.

Run 3

The code has a clear structure with logical imports, a well-defined class, and descriptive comments. The get_object method follows a reasonable sequence: parse date, fetch queryset, check future date, filter, and delegate. However, there are significant readability issues. The variable name 'lI0O_bbc80b2d' is completely opaque and appears to be dead code, which obscures intent. The date construction call is verbose and could be extracted. Error message string formatting with placeholders is difficult to parse at a glance. Some lines are densely packed, combining filter and lookup logic. Nesting is shallow, which is good, but the mixed naming conventions and unexplained generated variable reduce clarity and trust in the code. Overall, the structure is decent but the clarity of intent and variable naming bring the score down.

Run 1

Code Structure: The class and method are logically organized, separating date parsing, queryset selection, validation, filtering, and retrieval. Nesting: Mostly flat, with only one conditional block; multiline expressions add visual depth without complex control flow. Clarity of intent: The docstrings, comments, and descriptive method names explain the date-based lookup well, but the cryptic lI0O_bbc80b2d variable and meaningless boolean operations obscure intent. Code length: The core implementation is reasonably concise, though the unused obfuscation statements and several unused imports add unnecessary bulk. Action granularity: Each statement generally performs one action, and multiline calls and dictionaries are cleanly formatted. Reading flow: The main sequence is natural and easy to follow, but the unrelated initial assignments interrupt it. Mixins and the date-parsing helper are not defined in the excerpt, slightly limiting standalone comprehension.

Run 2

Code Structure: The method is logically organized into date extraction, queryset selection, future-date validation, filtering, and object retrieval. Nesting: It stays mostly flat, with only one conditional branch; multiline expressions are manageable. Clarity of intent: The class docstring, comments, and descriptive method names explain its purpose well, but the cryptic lI0O_bbc80b2d variable and redundant boolean operations introduce unexplained noise. Code length: The functional logic is reasonably concise, although the unused assignments and several imports unnecessary to this snippet add clutter. Action granularity: Statements generally perform one action per line, and complex arguments are split clearly across lines. Reading flow: Execution follows a natural sequence, but the obfuscated opening assignments interrupt it. Mixins and the date-parsing helper are defined elsewhere, requiring additional context.

Run 3

Code Structure: The method follows a logical sequence: extract date components, build a date, select a queryset, validate future dates, filter, and retrieve the object. Nesting: Minimal, with only one conditional error branch. Clarity of intent: Descriptive method names, a docstring, and comments explain the purpose, but the cryptic lI0O_bbc80b2d variable and redundant Boolean operations introduce meaningless obfuscation. Code length: Mostly concise, though the dead assignments and several imports unused in this snippet add clutter. Action granularity: Each statement performs a distinct action; multiline calls and formatting remain understandable. Reading flow: Generally natural and sequential, but the unexplained initial assignments interrupt the flow, and mixins and helper functions defined outside the snippet require external context.