Sample

pyint-752dca2b4957-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines85

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8710–1; higher is more readable
Mi0.5080–1; higher is more readable
LLOC33Logical lines; fewer is more readable
DeepSeek V4 Pro7.670–20; mean of three runs
GPT-6.1 Sol12.330–20; mean of three runs
BTTF0.7180–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 sen( self, req: PreparedRequest, str2: bool = False, tim: _t.TimeoutType = None, ver: _t.VerifyType = True, cer: _t.CertType = None, pro: 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 clo(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.644−6.966

Intercept 8.87 + feature contributions = -24.041 (log-odds).
Score = sigmoid(-24.041) = 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.927+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.587
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.965−0.357

Intercept 0.07 + feature contributions = 1.913 (log-odds).
Score = sigmoid(1.913) = 0.871.

Score0.508
Score33
Run 1

The code is largely unreadable due to severe naming issues and structural problems. The import section is excessively long and disorganized, making it difficult to identify what's actually used. Critical method names are truncated ('sen' instead of 'send', 'clo' instead of 'close'), obscuring their purpose entirely. Parameter names are also abbreviated ('tim' for timeout, 'ver' for verify, 'cer' for cert, 'pro' for proxies), making the `send` method signature nearly incomprehensible without the docstring. The docstring itself is well-formatted but paradoxically references parameter names ('request', 'stream', 'timeout', 'verify', 'cert', 'proxies') that do not match the actual abbreviated parameters. The code structure is flat but confusing - the BaseAdapter class has no clear organizational pattern. While the code is concise and actions are granulated (one per line), the ambiguous naming makes reading flow impossible without constant cross-referencing. The intent is unclear despite docstring documentation.

Run 2

The code has good structure with clear imports and class organization, but suffers from serious readability issues in method signatures. The parameter names 'sen', 'str2', 'tim', 'ver', 'cer', 'pro' are cryptic abbreviations that obscure intent, while the docstring uses descriptive names like 'stream', 'timeout', 'verify', 'cert', 'proxies'—showing the disconnect. The method name 'sen' and 'clo' are also truncated versions of 'send' and 'close'. Import organization is clean, and type hints are present but inconsistent (e.g., 'dict[str, str]' vs 'typing' imports). The BaseAdapter class has good documentation and logical structure. Action granularity is appropriate—one import per line, one parameter per line in method signatures. The nested imports from exceptions show good organization. Overall, the code is maintainable structurally but the cryptic naming would force developers to constantly reference documentation, significantly reducing readability.

Run 3

The code has several readability issues despite clean imports. Method names 'sen' and 'clo' are cryptic abbreviations that obscure intent, and parameter names (str2, tim, ver, cer, pro) are inconsistently abbreviated versus the docstring's descriptive parameter names (request, stream, timeout, etc.). The BaseAdapter class is straightforward with appropriate docstrings, but the method is essentially a stub - which is acceptable for an abstract base class. Import organization is logical and follows conventions. However, the parameter naming breaks reading flow and clarity of intent. The documentation partially compensates but creates a disconnect between code and comments. Structure is flat and simple, action granularity is appropriate, and length is concise. Overall, the abbreviated naming significantly undermines readability despite other strengths.

Run 1

Code Structure: The adapter class and its two methods are logically organized, but the extensive import block overwhelms the small implementation. Nesting: Very flat, with no complex control flow. Clarity of intent: The class description and docstrings explain the purpose, but abbreviated names such as sen, clo, str2, tim, and ver obscure meaning. Docstring parameter names do not match the signature, and PreparedRequest and _t are not defined or imported in the snippet, making annotations harder to interpret. Code length: The method bodies are concise, but many imports are unused in the displayed code, and the lengthy documentation is disproportionate to the implementation. Action granularity: Each executable line performs a single clear action. Reading flow: Conventional imports followed by a class provide a natural progression, but import clutter, cryptic identifiers, and inconsistent documentation interrupt comprehension.

Run 2

Code Structure: Imports and a small adapter class are logically organized, although the extensive imports overwhelm the minimal implementation. Nesting: Very flat, with no nested control flow. Clarity of intent: The adapter abstraction and docstrings communicate purpose, but abbreviated names such as sen, clo, str2, tim, ver, cer, and pro obscure meaning. Docstring parameter names do not match the signature, and PreparedRequest and _t are not defined or imported in the snippet, making annotations harder to interpret. Code length: Method bodies are concise, but many unused imports and lengthy documentation create disproportionate overhead. Action granularity: Each statement performs one action, and multiline signatures are easy to scan. Reading flow: Conventional import-to-class organization helps, but readers must pass substantial import clutter before reaching the implementation and reconcile cryptic identifiers with descriptive documentation.

Run 3

Code Structure: Imports precede a small, logically organized adapter class, though many imports are unused in this excerpt. Nesting: Methods are flat, with no complex control flow. Clarity of intent: The abstract transport interface is recognizable, but abbreviated names such as sen, clo, str2, ver, and cer obscure meaning. Docstring parameter names do not match the signature, and PreparedRequest and _t lack visible definitions or imports, increasing reader uncertainty. Code length: Method bodies are concise, but the extensive imports and lengthy documentation outweigh the minimal implementation. Action granularity: Each statement performs one action, and multiline signatures are easy to scan. Reading flow: Class and method ordering are natural, but inconsistent naming, mismatched documentation, and unexplained type references interrupt comprehension.