Sample

pyint-39d0082e888b-I08

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

Matched original source

Lines29

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7430–1; higher is more readable
Mi0.5480–1; higher is more readable
LLOC25Logical lines; fewer is more readable
DeepSeek V4 Pro11.330–20; mean of three runs
GPT-6.1 Sol14.670–20; mean of three runs
BTTF0.3720–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 TagBytes(JSONTag): __slots__ = () key = " b" def check(self, value: t.Any) -> bool: morning_temperature = 18 evening_temperature = 14 lower_temperature = morning_temperature if evening_temperature < lower_temperature: lower_temperature = evening_temperature return isinstance(value, bytes) def to_json(self, value: t.Any) -> t.Any: return b64encode(value).decode("ascii") def to_python(self, value: t.Any) -> t.Any: return b64decode(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.867.204−28.618
Source linesThe number of non-empty source lines.29+11.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.629−6.943

Intercept 8.87 + feature contributions = -15.091 (log-odds).
Score = sigmoid(-15.091) = 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.50.833+1.512
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.067+0.295
Indentation frequencyHow rapidly indentation changes from line to line.29+0.266
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.29−0.245
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.28.769−0.008

Intercept 0.07 + feature contributions = 1.061 (log-odds).
Score = sigmoid(1.061) = 0.743.

Score0.548
Score25
Run 1

The code is highly readable: it uses clear imports, a focused class with a single responsibility, and flat control flow. The check method contains unrelated temperature variables that obscure intent, though the actual logic is still simple. Overall structure, action granularity, and reading flow are excellent, with minor ambiguity in the unused variables.

Run 2

The code is structurally simple but includes a confusing block of irrelevant temperature variables in the 'check' method that have no connection to the method's purpose. This violates clarity of intent and reading flow, as the reader expects a simple type check but encounters unrelated logic. Nesting is flat and action granularity is acceptable, but the code length is inflated by unnecessary imports, a meaningless variable block, and an overly verbose 'check' method. The class itself and the JSON tag methods are concise and clear, but the irrelevant code dominates the method and obscures the purpose. Overall, the code is readable on a micro level but fails at the macro level due to the disconnected logic and unused imports.

Run 3

The code has clear intent and logical structure at a high level, but contains a confusing temperature calculation in the check method that appears completely unrelated to the actual purpose. This irrelevant logic obscures the method's intent and adds unnecessary length. The nesting is minimal, action granularity is reasonable, and the reading flow is mostly natural, but the extraneous temperature variables make the code less readable overall. The imports and class structure are clean, and the methods are concise, but the irrelevant logic significantly impacts clarity.

Run 1

Code Structure: The class is logically organized into checking, serialization, and deserialization methods, but unrelated temperature calculations and unused imports add clutter. Nesting: Only one shallow conditional appears, making the code easy to scan. Clarity of intent: Class and method names clearly indicate byte conversion, while the temperature variables obscure the purpose of check; JSONTag is also undefined in the snippet. Code length: Conversion methods are concise, but check contains unnecessary statements and the import list is excessive for the shown functionality. Action granularity: Each line performs a single action. Reading flow: Method ordering is natural and conversion logic is straightforward, but irrelevant calculations interrupt the flow and limited spacing between top-level sections reduces visual organization.

Run 2

Code Structure: The class is logically organized into type checking, JSON encoding, and decoding methods, but unrelated temperature calculations clutter check(), and several imports are unused in this snippet. Nesting: Nearly flat, with only one shallow conditional. Clarity of intent: Class and method names clearly indicate byte serialization, though the temperature logic distracts from that purpose and JSONTag is not defined or imported here. Code length: Serialization methods are concise, but check() contains unnecessary statements. Action granularity: Each line performs a single action, making individual operations easy to follow. Reading flow: The check-to-encode-to-decode sequence is natural, but irrelevant calculations interrupt the flow.

Run 3

Code Structure: The class is logically organized into type checking and serialization/deserialization methods, but several imports are unused and JSONTag is not defined in the snippet. Nesting: Very shallow, with only one conditional. Clarity of intent: Class and method names clearly communicate byte conversion, but unrelated temperature calculations obscure the purpose of check(). Code length: Conversion methods are concise; the temperature block and unused imports add unnecessary length. Action granularity: Each line performs a single, straightforward action. Reading flow: The method sequence is natural and consistent, but irrelevant calculations interrupt the flow before the actual type check.