Sample

pyint-5a66b4f65b55-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines22

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.6680–1; higher is more readable
Mi0.570–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro13.330–20; mean of three runs
GPT-6.1 Sol11.330–20; mean of three runs
BTTF0.4460–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 PassList(JSONTag): __slots__ = () def write(self, event: t.Any) -> bool: return isinstance(event, list) def measure(self, token: t.Any) -> t.Any: return [self.serializer.tag(mode) for mode in token] tag = to_json

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.666.951−22.009
Source linesThe number of non-empty source lines.22+8.8
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.67−7.005

Intercept 8.87 + feature contributions = -11.345 (log-odds).
Score = sigmoid(-11.345) = 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.59.957+1.126
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.071+0.253
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.23+0.222
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.21.754−0.106
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.22−0.084
Indentation frequencyHow rapidly indentation changes from line to line.22+0.024

Intercept 0.07 + feature contributions = 0.7 (log-odds).
Score = sigmoid(0.7) = 0.668.

Score0.57
Score18
Run 1

The code is generally readable with a clear structure: imports are organized, class definition is concise, and methods are short with single responsibilities. Nesting is flat, and the intent of each method is mostly clear from naming. However, several issues reduce clarity: 'PassList' inherits from JSONTag which is not defined in the snippet, creating ambiguity. The 'write' method's purpose return boolean based on list type is unclear without broader context. The 'measure' method uses 'token' as parameter name, which is vague for a list context. Action granularity is good with one action per line. Reading flow is natural for those familiar with the codebase, but the undefined JSONTag and 'to_json' reference make it harder to understand in isolation. Overall it's concise but lacks sufficient context for standalone comprehension.

Run 2

The code is moderately readable but has several issues. On the positive side, it uses type hints, explicit imports, and a flat class structure with minimal nesting. However, the intent is ambiguous: 'PassList', 'measure', and 'mode' are unclear without context, and the relationship to JSONTag or to_json is not obvious. The code is also incomplete—referenced symbols like JSONTag and to_json are not defined in the snippet, making it hard to evaluate structure. Action granularity is good (one action per line), but reading flow suffers due to missing context and abstract naming. The short length helps, but it hides complexity. Overall, code is concise and syntactically clean, yet falls short on clarity of intent and logical organization due to unexplained abstractions and missing surrounding context.

Run 3

The code is relatively readable but has some clarity and structure issues. Imports are logically grouped, and the class is concise with clear method names ('write', 'measure'). However, the class lacks a docstring, and the purpose of 'PassList' is unclear from the code alone. The 'tag = to_json' assignment at the end is ambiguous—it's unclear if 'to_json' is imported or defined elsewhere, and the reassignment inside 'measure' conflicts with this assignment. The 'measure' method contains a list comprehension on a single line, which is acceptable but slightly dense. Overall, the code is short and not deeply nested, but intent and structure could be improved with comments or clearer naming.

Run 1

1. Code Structure: Imports and a small class are logically separated, but many imports are unused in the snippet, and JSONTag is not defined or imported. 2. Nesting: Very shallow; methods and the list comprehension are easy to scan. 3. Clarity of intent: List detection and element tagging are understandable, but names such as write, measure, event, token, and mode poorly communicate their roles. The assignment tag = to_json references an undefined name, further obscuring intent. 4. Code length: The class is concise, although the imports add substantial clutter relative to its size. 5. Action granularity: Each statement performs a focused action; the comprehension is compact without being overloaded. 6. Reading flow: The basic top-to-bottom flow is natural, but missing dependencies, inconsistent naming, and the unexplained final alias interrupt comprehension.

Run 2

Code Structure: Imports and a compact class are logically organized, but numerous unused imports and undefined references (JSONTag and to_json) obscure context. Nesting: Very shallow; the comprehension is easy to follow. Clarity of intent: The list check and element tagging are understandable, but names such as write, measure, event, token, and mode poorly convey their roles, and the tag alias is unexplained. Code length: Methods are concise, although imports add substantial clutter relative to the implementation. Action granularity: Each statement performs one clear action; the comprehension remains readable. Reading flow: Conventional top-to-bottom organization helps, but inconsistent terminology and unresolved dependencies interrupt understanding.

Run 3

Code Structure: Imports and a small class are logically organized, but numerous unused imports distract from the implementation, and JSONTag and to_json are not defined in the snippet. Nesting: Methods are flat and easy to scan. Clarity of intent: The list check and tagging comprehension are understandable, but names such as write, measure, event, token, and mode poorly describe their roles; the tag assignment is also unclear without context. Code length: The class is concise, though the imports are disproportionately long for the functionality shown. Action granularity: Each line performs one clear operation. Reading flow: Conventional layout supports scanning, but inconsistent terminology and unresolved references interrupt comprehension.