Sample

pyint-e627c52a913a-I10

Deterministically remove some optional blank lines and bracketed line breaks

Matched original source

Lines23

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7660–1; higher is more readable
Mi0.7080–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro14.670–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.1280–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: 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.702.957−23.198
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.707−7.061

Intercept 8.87 + feature contributions = -12.189 (log-odds).
Score = sigmoid(-12.189) = 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.47+1.675
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.076+0.202
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.24+0.187
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.23−0.107
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.22.688−0.093
Indentation frequencyHow rapidly indentation changes from line to line.23+0.058

Intercept 0.07 + feature contributions = 1.187 (log-odds).
Score = sigmoid(1.187) = 0.766.

Score0.708
Score20
Run 1

The code is generally clean and readable, with clear imports and a straightforward class structure. It uses type hints, a simple class definition, and concise methods. However, the score is reduced due to several issues: the class inherits from JSONTag which is not imported in the snippet, creating ambiguity about dependencies; the `__slots__` and `key` attributes are understandable but lack context; the `to_json` and `to_python` methods are missing a blank line between them, slightly hurting readability; and the purpose of the class could be more explicit without knowing the broader context. The code follows good action granularity and has flat nesting, but the missing import and minor formatting issues prevent a higher score.

Run 2

The code is generally readable with clear class structure and concise methods. However, there are minor issues: the two methods `to_json` and `to_python` are on consecutive lines without a blank line between them, slightly reducing readability and flow. The import block is well-organized and explicit. The use of `t.Any` and `Markup`/`loads`/`dumps`/`UUID`/`b64decode`/`b64encode` suggests unused imports, which could be cleaned up. Nesting is nonexistent and action granularity is fine. Intent is clear, though the class name `TagDateTime` and key ' d' could benefit from a brief comment. Overall, it is readable but slightly marred by formatting and possible dead imports.

Run 3

The code is moderately readable, but has a few issues. The class structure and method definitions are logical, and the use of type hints and imports is clear. However, the class references 'JSONTag' which is not imported or defined in the snippet, creating ambiguity. The 'to_json' and 'to_python' methods are placed consecutively without a blank line between them, which slightly disrupts reading flow and conventional PEP 8 style. The 'check' method is clear and concise, but the overall intent of the class is not immediately obvious without seeing the parent class. The score reflects good but not excellent readability due to minor structural and contextual gaps.

Run 1

Code Structure: A small, logically organized class groups type checking and conversion methods, though numerous unused imports add clutter and JSONTag is not defined or imported in the snippet. Nesting: Methods are flat and contain no nested control flow. Clarity of intent: Class and method names clearly convey datetime serialization and deserialization; the cryptic key " d" and broad Any annotations provide little additional guidance. Code length: The class is concise, but the import block is disproportionately long for the functionality shown. Action granularity: Each statement performs one action, making individual operations easy to follow. Reading flow: Methods progress naturally from checking to serialization and deserialization, but missing blank lines between imports and the class, and between conversion methods, slightly reduce visual separation.

Run 2

Code Structure: The class logically groups datetime type checking and conversion methods, though unrelated imports add clutter and JSONTag is not defined or imported in the snippet. Nesting: Methods are flat and straightforward. Clarity of intent: Descriptive class and method names make serialization intent clear, but the opaque key " d" is unexplained and broad Any annotations provide little type information. Code length: The implementation is concise, although several imports are unused here. Action granularity: Each line performs one clear action. Reading flow: The progression from checking to JSON conversion to Python conversion is natural; a missing blank line between the conversion methods slightly reduces visual separation.

Run 3

Code Structure: The class logically groups datetime detection and conversion methods, although several imports are unused in this snippet and JSONTag is not defined or imported. Nesting: Methods are flat, with no nested control flow. Clarity of intent: Class and method names clearly convey datetime serialization, but the cryptic key " d" and broad t.Any annotations provide little context. Code length: The implementation is concise, though unrelated imports add visual clutter. Action granularity: Each line performs a single, straightforward action. Reading flow: Methods follow a natural check-to-serialization-to-deserialization sequence, but missing blank lines after imports and between conversion methods slightly reduce readability.