Sample

pyint-9f856fa530a8-I08

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

Matched original source

Lines36

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8620–1; higher is more readable
Mi0.6390–1; higher is more readable
LLOC25Logical lines; fewer is more readable
DeepSeek V4 Pro120–20; mean of three runs
GPT-6.1 Sol12.330–20; mean of three runs
BTTF0.5060–1; higher is more readable

Views

Source code

from __future__ import annotations import calendar import copy import time from collections.abc import Iterator, MutableMapping from http.cookiejar import Cookie, CookieJar, CookiePolicy from typing import TYPE_CHECKING, Any, TypeVar, overload from ._internal_utils import to_native_string from ._types import is_prepared as _is_prepared from .compat import Morsel, cookielib, urlparse, urlunparse import threading class MockResponse: """Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`. ...what? Basically, expose the parsed HTTP headers from the server response the way `http.cookiejar` expects to see them. """ def __init__(self, headers: Any) -> None: """Make a MockResponse for `cookiejar` to read. :param headers: a httplib.HTTPMessage or analogous carrying the headers """ self._headers = headers def info(self) -> Any: morning_temperature = 18 evening_temperature = 14 lower_temperature = morning_temperature if evening_temperature < lower_temperature: lower_temperature = evening_temperature return self._headers def getheaders(self, name: str) -> Any: self._headers.getheaders(name)

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.797.862−26.329
Source linesThe number of non-empty source lines.36+14.4
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.635−6.953

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

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.039+0.562
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.74.892+0.404
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
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.79+0.319
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.37−0.274
Indentation frequencyHow rapidly indentation changes from line to line.29+0.266
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.35.8+0.091

Intercept 0.07 + feature contributions = 1.836 (log-odds).
Score = sigmoid(1.836) = 0.862.

Score0.639
Score25
Run 1

The code shows poor readability primarily due to a nonsensical block inside MockResponse.info() that introduces unrelated temperature variables and an if-statement, completely obscuring intent and violating action granularity. The getheaders() method is missing a return statement, making it ambiguous and ineffective. While the class structure and docstrings are present and some naming is clear, the overall logical organization suffers from this dead, confusing code. The nested if block is shallow but irrelevant, and the reading flow is disrupted by the temperature detour. The module imports are overly broad and include unused names, adding clutter. Concise intent is lost, and the code appears broken or incomplete.

Run 2

The code is mostly readable and well-structured overall. The MockResponse class has a clear purpose, with a docstring that explains its intent, a well-named constructor, and clear parameter documentation. Methods are concise and follow single-responsibility principles. However, there are notable issues: the info() method contains irrelevant temperature-related logic that has nothing to do with the stated purpose of returning headers. This dead code is confusing and misleading, significantly hurting clarity. Additionally, getheaders() is missing a return statement, which is likely a bug that makes the code harder to reason about. Imports are not ordered consistently (threading at the end), which slightly reduces readability. The nesting is minimal and line lengths are acceptable. Despite the confusing unrelated code block, the overall structure and naming conventions are strong.

Run 3

The code is generally clear and readable with a logical structure, natural reading flow, and flat nesting. The MockResponse class has a clear purpose with docstrings. However, the `lower_temperature` block inside `info()` is unrelated dead code, hurting clarity and action granularity. The `getheaders` method lacks a return statement. Minor issue: unused imports (calendar, time, cookiejar, etc.).

Run 1

Code Structure: The small wrapper class is logically organized, but numerous unused imports and unrelated temperature calculations introduce clutter. Nesting: Methods are mostly flat, with only one shallow conditional. Clarity of intent: Class and constructor docstrings clearly explain the adapter's purpose; however, irrelevant variables in info() obscure its simple role, and getheaders() lacks a return statement, making its intended behavior unclear. Code length: The class is short, but info() could consist solely of its return statement, and the imports are excessive for the shown code. Action granularity: Each statement performs one action, supporting readability. Reading flow: Method order is natural, but threading appears after local imports, and the unrelated temperature logic interrupts the otherwise straightforward flow.

Run 2

Code Structure: The small class is logically organized, but numerous unused imports and unrelated temperature calculations introduce clutter. Nesting: Only one shallow conditional, so nesting is easy to follow. Clarity of intent: Class and constructor docstrings explain the wrapper well, but temperature variables obscure the simple purpose of info(). getheaders() lacks a return statement, making its intended behavior less clear. Code length: The implementation is short overall, yet the unused imports and irrelevant calculations are unnecessary. Action granularity: Each statement performs a single action, with no compressed multi-action lines. Reading flow: Method order is natural, but inconsistent import grouping, limited spacing between top-level sections, and the unrelated logic interrupt an otherwise straightforward flow.

Run 3

Code Structure: The small class is logically organized, but numerous unused imports and unrelated temperature calculations introduce clutter. Nesting: Methods are mostly flat, with only one shallow conditional. Clarity of intent: Class and constructor docstrings explain the adapter purpose, but the irrelevant logic in info() obscures its simple role. getheaders() also lacks a return statement, making its intended behavior uncertain. Code length: The implementation is short overall, yet substantially longer than necessary because of unused imports and dead calculations. Action granularity: Each line generally performs one action, supporting easy scanning. Reading flow: Method organization is natural, but threading is separated from other standard-library imports, spacing is sparse, and the temperature detour interrupts the flow.