Sample

pyint-cc436b081f57-I05

Rewrite eligible decimal integer literals in hexadecimal notation

Matched original source

Lines24

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7650–1; higher is more readable
Mi0.7130–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro180–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.1290–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.24+9.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.707−7.061

Intercept 8.87 + feature contributions = -11.789 (log-odds).
Score = sigmoid(-11.789) = 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.46.92+1.678
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.25+0.151
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.24−0.13
Indentation frequencyHow rapidly indentation changes from line to line.24+0.093
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.23.583−0.08

Intercept 0.07 + feature contributions = 1.18 (log-odds).
Score = sigmoid(1.18) = 0.765.

Score0.713
Score20
Run 1

The code is highly readable with a clear, logical structure. It uses a flat hierarchy with no nesting, making the control flow obvious. Each class method has a single, well-defined purpose with clear intent expressed through descriptive method names and type hints. The code is concise, avoiding unnecessary boilerplate, and maintains one action per line. The reading flow is natural, grouping related imports together and organizing class methods in a logical sequence (check, to_json, to_python). The use of `__slots__` and type hints demonstrates thoughtful design without sacrificing clarity.

Run 2

The code is highly readable, with a clear class structure and logical organization. Imports are properly grouped and formatted. The class uses a single-key design pattern with focused methods, each performing one action (checking type, converting to JSON, converting to Python). Nesting is minimal, with flat, straightforward control flow. Method names like 'check', 'to_json', and 'to_python' clearly convey intent. Code length is concise, avoiding unnecessary boilerplate. Action granularity is well-maintained - each method does exactly one thing. Reading flow is natural and top-down. Minor deductions: the one-letter key ' d' could benefit from a clarifying comment, and the class references 'JSONTag' without showing its definition in this snippet, which could affect standalone comprehension. Overall, this follows clean code principles well.

Run 3

The code is highly readable and follows clean coding practices. It has a logical structure: imports are organized, and the class is focused with a single responsibility. Nesting is minimal—each method returns immediately without nested conditionals. Intent is clear: the class represents a JSON tag for datetime serialization, and method names (check, to_json, to_python) are descriptive. The code is concise, with no unnecessary duplication or verbosity. Action granularity is appropriate—each line performs one clear action, such as type checking or conversion. Reading flow is natural, progressing from base imports to specific methods. The use of type hints and __slots__ adds clarity and intent. Minor deductions are for the slightly cryptic key value ' d', but this is likely intentional for JSON tag identification in a larger system.

Run 1

Code Structure: The class is logically organized into type checking, JSON conversion, and Python 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 describe datetime serialization, but the key " d" is unexplained and broad Any annotations provide limited guidance. Code length: The implementation is concise, though unused imports add clutter. Action granularity: Each statement performs one action. Reading flow: Consistent formatting and the check-to-conversion sequence make the class easy to follow; import clutter and missing base-class context slightly interrupt readability.

Run 2

Code Structure: The class logically groups type checking and bidirectional datetime conversion, although several imports are unused in this snippet and JSONTag is not defined or imported. Nesting: Methods are flat, with no unnecessary branching. Clarity of intent: Class and method names make serialization behavior clear, but the opaque key " d" and broad Any annotations provide little context. Code length: The implementation is concise, though unused imports add clutter. Action granularity: Each statement performs one action, and each method has a single responsibility. Reading flow: The progression from checking the value type to JSON conversion and Python conversion is natural; a brief explanation of the tag key would improve readability.

Run 3

Code Structure: The class is logically organized into type checking and two conversion methods, though several imports are unused in this snippet and JSONTag is not defined or imported. Nesting: There is no unnecessary nesting; each method has a single return statement. Clarity of intent: TagDateTime and its method names clearly communicate datetime serialization and deserialization, but the key " d" is unexplained and t.Any annotations provide little type specificity. Code length: The implementation is concise, although the import list adds unrelated overhead. Action granularity: Each line performs one clear action. Reading flow: The progression from checking to encoding to decoding is natural; additional spacing between imports and the class would improve visual separation.