Sample

pyint-4bdf396f2be7-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines85

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8720–1; higher is more readable
Mi0.5080–1; higher is more readable
LLOC33Logical lines; fewer is more readable
DeepSeek V4 Pro150–20; mean of three runs
GPT-6.1 Sol10.330–20; mean of three runs
BTTF0.6970–1; higher is more readable

Views

Source code

from __future__ import annotations import os.path import socket # noqa: F401 import typing import warnings from typing import Any from urllib3.exceptions import ( ClosedPoolError, ConnectTimeoutError, LocationValueError, MaxRetryError, NewConnectionError, ProtocolError, ReadTimeoutError, ResponseError, ) from urllib3.exceptions import HTTPError as _HTTPError from urllib3.exceptions import InvalidHeader as _InvalidHeader from urllib3.exceptions import ProxyError as _ProxyError from urllib3.exceptions import SSLError as _SSLError from urllib3.poolmanager import PoolManager, proxy_from_url from urllib3.util import Timeout as TimeoutSauce from urllib3.util import parse_url from urllib3.util.retry import Retry from .auth import _basic_auth_str from .compat import basestring, urlparse from .cookies import extract_cookies_to_jar from .exceptions import ( ConnectionError, ConnectTimeout, InvalidHeader, InvalidProxyURL, InvalidSchema, InvalidURL, ProxyError, ReadTimeout, RetryError, SSLError, ) from .models import Response from .structures import CaseInsensitiveDict from .utils import ( DEFAULT_CA_BUNDLE_PATH, get_auth_from_url, get_encoding_from_headers, prepend_scheme_if_needed, select_proxy, urldefragauth, ) from ._types import is_prepared as _is_prepared class BaseAdapter: """The Base Transport Adapter""" def __init__(self) -> None: super().__init__() def sort( self, summary: PreparedRequest, config: bool = False, address: _t.TimeoutType = None, source: _t.VerifyType = True, date: _t.CertType = None, channel: dict[str, str] | None = None, ) -> Response: """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) <timeouts>` tuple. :type timeout: float or tuple :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. """ raise NotImplementedError def write(self) -> None: """Cleans up adapter specific items.""" raise NotImplementedError

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.1816.539−59.946
Source linesThe number of non-empty source lines.85+34
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.645−6.967

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.86−2.009
Indentation frequencyHow rapidly indentation changes from line to line.71+1.719
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.84.938+0.777
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.94.965+0.728
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.036+0.59
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.94.977−0.358

Intercept 0.07 + feature contributions = 1.916 (log-odds).
Score = sigmoid(1.916) = 0.872.

Score0.508
Score33
Run 1

The code is generally clear and well-structured with logical imports grouped by source (stdlib, third-party, local) and a simple class definition. Nesting is flat, intent is explicit through type hints and docstrings, and length is reasonable. However, readability is slightly reduced by several naming mismatches: the method `sort` should logically be `send`, and its parameters (`summary`, `config`, `address`, `source`, `date`, `channel`) do not match the documented names (`request`, `stream`, `timeout`, `verify`, `cert`, `proxies`), creating ambiguity. Method `write` likely should be `close`. Action granularity and reading flow are otherwise fine, but the parameter/docstring discrepancy prevents a higher score.

Run 2

The code has good structure with clear imports and a well-organized class definition. Naming is inconsistent and confusing: the BaseAdapter class has methods named 'sort' and 'write' that do not match their docstrings ('Sends PreparedRequest', 'Cleans up adapter'). The 'send' method's parameters are obfuscated (summary, config, address, source, date, channel instead of request, stream, timeout, verify, cert, proxies). Docstrings are thorough and helpful, but they describe the original parameter names, not the obfuscated ones. The code is relatively flat with minimal nesting, and each method has a single clear action (raise NotImplementedError). Imports are logical and well-grouped. Overall, the structure is clean but the misleading naming hurts clarity of intent significantly.

Run 3

The code has clear strengths: organized imports (orderly groups from stdlib to third-party to local), short simple classes, one action per line, and reasonable docstrings. The BaseAdapter class is structurally clean with flat methods and good separation. However, significant readability issues hurt the score. The `sort` method has misleading parameter names (summary, config, address, source, date, channel) that do not match what the implementation suggests (request, stream, timeout, verify, cert, proxies), creating a severe clarity-of-intent problem. The docstring references parameters that do not align with the actual signature, further confusing readers. Type hints are inconsistent, with some parameters using `_t.TimeoutType` and `_t.VerifyType` while others use inline types. The unused `socket` import with `# noqa` adds noise. The `from __future__ import annotations` and `typing` import appear at top level without clear necessity. Both methods raise `NotImplementedError`, which may be intentional for an abstract base, but the class does not inherit from `ABC` or use `@abstractmethod`, creating ambiguity about its intended usage. Overall, structure is decent but naming inconsistencies and docstring mismatches undermine readability.

Run 1

1. Code Structure: Imports and a small adapter class are logically separated, but numerous unused imports overwhelm the implementation. 2. Nesting: Methods are flat, with no nested control flow, making them easy to scan. 3. Clarity of intent: The adapter abstraction is recognizable, but names such as sort, write, summary, and date obscure transport operations. The docstring describes parameter names absent from the signature, and PreparedRequest and _t are not defined or imported in the snippet. 4. Code length: Method bodies are concise, but excessive imports and mismatched documentation add unnecessary reading. 5. Action granularity: Each statement performs one action, and the multiline signature is readable. 6. Reading flow: Conventional formatting helps, but readers must reconcile misleading names, documentation, and unresolved type references.

Run 2

1. Code Structure: Imports and the adapter class are logically separated, but many imports are unused in this snippet, obscuring its small scope. 2. Nesting: Flat methods with no nested control flow are easy to scan. 3. Clarity of intent: The abstract transport-adapter purpose is recognizable, but names such as sort, write, summary, and date are misleading. The sort docstring describes different parameter names from those in its signature, and PreparedRequest and _t are not defined or imported here. 4. Code length: Method bodies are concise, but extensive imports and mismatched documentation disproportionately lengthen this minimal interface. 5. Action granularity: Each statement performs one action, and multiline signatures and imports remain readable. 6. Reading flow: Conventional formatting helps, but readers must reconcile naming, annotations, and documentation to understand the intended API.

Run 3

Code Structure: Imports are grouped and the adapter class is logically organized, but many imports are unused in this snippet, and PreparedRequest and _t lack visible definitions. Nesting: Very flat, with no complex control flow. Clarity of intent: The largest weakness; sort and write obscure the intended send and cleanup operations, while parameters such as summary, address, and date conflict with the request, timeout, and certificate terminology in the docstring. Code length: The class is concise, but the extensive import block and mismatched documentation add reading overhead. Action granularity: Statements generally perform one action per line, and multiline signatures are easy to scan. Reading flow: Conventional layout helps, but readers must reconcile misleading names, documentation, and unresolved type references to understand the interface.