Sample

pyint-79de9ce07eee-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines31

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.850–1; higher is more readable
Mi0.6550–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro140–20; mean of three runs
GPT-6.1 Sol12.670–20; mean of three runs
BTTF0.7160–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, version: Any) -> None: """Make a MockResponse for `cookiejar` to read. :param headers: a httplib.HTTPMessage or analogous carrying the headers """ self._headers = version def sync(self) -> Any: return self._headers def removeData(self, path: str) -> Any: self._headers.getheaders(path)

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.679.461−22.422
Source linesThe number of non-empty source lines.31+12.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.715−7.072

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

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.041+0.539
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.74.219+0.393
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.78.938+0.322
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.32−0.097
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.30.738+0.02

Intercept 0.07 + feature contributions = 1.738 (log-odds).
Score = sigmoid(1.738) = 0.85.

Score0.655
Score20
Run 1

The code is relatively readable with clear imports, type hints, and docstrings. The class `MockResponse` has a logical structure and methods with descriptive names. Nesting is minimal, and intent is generally clear. However, several issues reduce readability: the `__init__` parameter is named `version` but the docstring refers to `headers`, creating ambiguity. The method names `sync` and `removeData` are confusing—`sync` returns headers, and `removeData` actually calls `getheaders` without returning anything, which is misleading. There is also an unused `removeData` parameter `path` that doesn't affect the call. The docstring for `init` is helpful but inconsistent with the code. Additionally, the class lacks a clear overall purpose despite the initial description. Overall, it’s concise but some naming and documentation mismatches hurt clarity.

Run 2

The code is generally readable and follows good structure with clear class definition and docstrings. The imports are organized, and the class has a focused single responsibility. However, there are some issues: the `sync()` and `removeData()` methods lack docstrings and the `removeData()` method doesn't return a value despite its name implying removal. The `__init__` docstring references a `headers` parameter but the actual parameter is named `version`, creating confusion. The method names are somewhat unclear in intent ('sync' and 'removeData' don't obviously relate to 'MockResponse'). There's also a call to `self._headers.getheaders(path)` without handling its return value, which could be a bug or unclear. The overall structure is flat and readable, but the ambiguity in naming and missing documentation for some methods reduces clarity.

Run 3

The code is moderately readable due to inconsistent implementation and unclear intent. The MockResponse class has a docstring explaining its purpose, but the code does not fulfill that purpose correctly. The constructor takes a parameter named 'version' but the docstring refers to 'headers', creating ambiguity. The sync() method simply returns the stored object, while removeData() calls getheaders() but ignores the return value, suggesting a bug. The method names are vague and do not clearly indicate their behavior. The overall structure is flat and simple, with no nested logic, which improves readability, but the lack of type clarity and misleading naming reduce clarity. The unused imports and type annotations suggest potential dead code or incomplete implementation. While the code is short and follows basic Python conventions, the disconnect between documentation, naming, and implementation makes it hard to understand the true intent.

Run 1

Code Structure: A small class cleanly groups header-wrapper behavior, but numerous unused imports and the misplaced threading import distract. Nesting: Methods are flat and easy to scan. Clarity of intent: The class docstring explains its purpose, but names such as version, sync, removeData, and path poorly describe header-related operations. The constructor docstring documents headers rather than its actual version parameter, and removeData calls getheaders without returning its result, making its intent unclear. Code length: The class is concise, but imports dominate the snippet unnecessarily. Action granularity: Each executable line performs one straightforward action. Reading flow: Method order is natural, but inconsistent naming, mismatched documentation, and import organization interrupt comprehension.

Run 2

Code Structure: A small class with clearly separated methods is logically organized, but numerous unused imports and inconsistent import grouping add clutter. Nesting: Flat and easy to follow, with no nested control flow. Clarity of intent: The class docstring explains the adapter's purpose, but the constructor parameter 'version' conflicts with its documented 'headers' parameter and actual use. Names such as 'sync', 'removeData', and 'path' do not clearly describe header-related behavior; removeData also discards the result despite its Any return annotation. Code length: Methods are concise, though imports disproportionately lengthen the snippet. Action granularity: Each statement performs one action, making individual lines easy to read. Reading flow: The class is straightforward to scan, but inconsistent naming conventions, misplaced threading import, and mismatched documentation interrupt comprehension.

Run 3

Code Structure: A small class with clearly separated methods is easy to navigate, but numerous unused imports and the misplaced threading import add clutter. Nesting: Methods are flat, with no nested control flow. Clarity of intent: The class docstring explains its adapter role, but the constructor parameter 'version' actually holds headers, while its docstring names 'headers'. Method names 'sync' and 'removeData' poorly describe returning headers and retrieving header values; removeData also discards the result despite its Any return annotation. Code length: The class is concise, but imports are excessive for the shown functionality. Action granularity: Each executable line performs a single straightforward action. Reading flow: The simple class layout flows naturally, though inconsistent naming, import organization, and documentation interrupt comprehension.