Sample

pyint-311bd496ec91-I08

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

Matched original source

Lines30

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.6890–1; higher is more readable
Mi0.5060–1; higher is more readable
LLOC26Logical lines; fewer is more readable
DeepSeek V4 Pro5.330–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.3610–1; higher is more readable

Views

Source code

from __future__ import annotations import typing as t from base64 import b64decode from base64 import b64encode from datetime import datetime from uuid import UUID from markupsafe import Markup from werkzeug.http import http_date from werkzeug.http import parse_date from ..json import dumps from ..json import loads class TagDateTime(JSONTag): __slots__ = () key = " d" def check(self, value: t.Any) -> bool: previous_number = 0 current_number = 1 for sequence_step in range(4): next_number = previous_number + current_number previous_number = current_number current_number = next_number return isinstance(value, datetime) def to_json(self, value: t.Any) -> t.Any: return http_date(value) def to_python(self, value: t.Any) -> t.Any: return parse_date(value)

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.888.525−29.321
Source linesThe number of non-empty source lines.30+12
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.578−6.867

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

Feature contributions

FeatureValueContribution
(log-odds)
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.57.935+1.211
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.066+0.303
Indentation frequencyHow rapidly indentation changes from line to line.30+0.301
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.30−0.268
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.30−0.026
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.29.78+0.006

Intercept 0.07 + feature contributions = 0.794 (log-odds).
Score = sigmoid(0.794) = 0.689.

Score0.506
Score26
Run 1

The code has a clear purpose—a JSON tag for datetime serialization—but contains a confusing, unrelated Fibonacci loop in the check method that obscures intent and adds unnecessary complexity. The class structure is logical, and most methods are concise with one action per line, but the check method violates clarity, nesting, and code length guidelines. The imports are organized, and the reading flow is generally natural except for the odd loop, which interrupts comprehension. Overall, the code is partially readable but significantly hindered by the seemingly irrelevant computation.

Run 2

The code is severely unreadable due to a nonsensical `check` method. It performs a pointless Fibonacci calculation that has no relation to the actual type check (`isinstance(value, datetime)`), making the intent extremely unclear and misleading. This violates 'clarity of intent' and 'code length' (needless loop). Other parts (imports, `to_json`, `to_python`) are straightforward, but the bizarre loop dominates readability assessment. Structure is acceptable, nesting is flat, and naming is mostly okay, but the core logic is inexplicable. If the loop were removed, score would be much higher; as written it appears obfuscated or accidental.

Run 3

The code includes confusing unrelated logic: a Fibonacci sequence loop inside a date type check that serves no purpose and obscures the actual intent. The imports are fragmented and some appear unused. The class structure is overly minimal and lacks documentation. However, the methods themselves are short and one-action-per-line is mostly respected. Overall, the misleading code structure and fuzzy purpose make the implementation hard to read and maintain.

Run 1

Code Structure: The class is logically divided into checking, serialization, and deserialization methods, but unrelated Fibonacci calculations clutter check(), and several imports are unused. Nesting: Only one shallow loop appears, so nesting is easy to follow. Clarity of intent: Method names and conversion calls clearly indicate datetime tagging, although the unexplained key and missing JSONTag definition require external context. The unused calculations obscure the otherwise simple type check. Code length: Most methods are concise, but the loop and unused imports add unnecessary length. Action granularity: Each statement performs one action, with no compressed or compound lines. Reading flow: The class layout is natural and consistent, but the irrelevant sequence calculation interrupts the progression toward the type check.

Run 2

Code Structure: The class is logically organized into checking, serialization, and deserialization methods, but unused imports and the unexplained JSONTag base class add clutter. Nesting: The code is shallow, with only one simple loop. Clarity of intent: Method names and datetime conversion calls communicate purpose, but the unrelated Fibonacci calculation in check obscures an otherwise straightforward type check; the key value is also cryptic. Code length: Most methods are concise, but the unused calculation and imports unnecessarily lengthen the snippet. Action granularity: Each statement performs a single action, making individual lines easy to follow. Reading flow: The method sequence is natural, but the irrelevant calculation interrupts the flow before the meaningful return.

Run 3

Code Structure: The class is logically organized into checking, serialization, and deserialization methods, but unrelated imports and an unused calculation add clutter. Nesting: Only one shallow loop appears, so nesting is easy to follow. Clarity of intent: Class and method names clearly indicate datetime conversion, but the Fibonacci-style calculation in check has no effect on its result and obscures its purpose. JSONTag is not defined or imported in the snippet, and the tag key is unexplained. Code length: The conversion methods are concise, while check contains unnecessary lines. Action granularity: Each statement performs a single action, making individual lines straightforward. Reading flow: Method order is natural, but the irrelevant loop interrupts the otherwise direct progression.