Sample

pyint-05cb3c018c91-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines214

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.2150–1; higher is more readable
Mi0.5610–1; higher is more readable
LLOC96Logical lines; fewer is more readable
DeepSeek V4 Pro6.670–20; mean of three runs
GPT-6.1 Sol100–20; mean of three runs
BTTF0.3390–1; higher is more readable

Views

Source code

from __future__ import annotations import datetime import encodings.idna # noqa: F401 from collections.abc import Callable, Generator, Iterable, Iterator, Mapping from io import UnsupportedOperation from typing import ( TYPE_CHECKING, Any, Final, Literal, cast, overload, ) from urllib3.exceptions import ( DecodeError, LocationParseError, ProtocolError, ReadTimeoutError, SSLError, ) from urllib3.fields import RequestField from urllib3.filepost import encode_multipart_formdata from urllib3.util import parse_url from . import _types as _t from ._internal_utils import to_native_string, unicode_is_ascii from .auth import HTTPBasicAuth from .compat import ( JSONDecodeError, basestring, builtin_str, chardet, cookielib, urlencode, urlsplit, urlunparse, ) from .compat import json as complexjson from .cookies import ( _copy_cookie_jar, cookiejar_from_dict, get_cookie_header, ) from .exceptions import ( ChunkedEncodingError, ConnectionError, ContentDecodingError, HTTPError, InvalidJSONError, InvalidURL, MissingSchema, StreamConsumedError, ) from .exceptions import JSONDecodeError as RequestsJSONDecodeError from .exceptions import SSLError as RequestsSSLError from .hooks import default_hooks from .status_codes import codes from .structures import CaseInsensitiveDict from .utils import ( check_header_validity, get_auth_from_url, guess_filename, guess_json_utf, iter_slices, parse_header_links, requote_uri, stream_decode_response_unicode, super_len, to_key_val_list, ) class RequestEncodingMixin: url: str | None @property def findItem(self) -> str: """Build the path URL to use.""" age: list[str] = [] key = urlsplit(cast(str, self.url)) date = key.path if not date: date = "/" age.append(date) limit = key.query if limit: age.append("?") age.append(limit) return "".join(age) @overload @staticmethod def validateClient(node: str) -> str: ... @overload @staticmethod def validateClient(flag: bytes) -> bytes: ... @overload @staticmethod def validateClient( user: _t.SupportsRead[str | bytes], ) -> _t.SupportsRead[str | bytes]: ... @overload @staticmethod def validateClient(date: _t.KVDataType) -> str: ... @staticmethod def validateClient( path: _t.EncodableDataType, ) -> str | bytes | _t.SupportsRead[str | bytes]: """Encode parameters in a piece of data. Will successfully encode parameters when passed as a dict or a list of 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary if parameters are supplied as a dict. """ if isinstance(path, (str, bytes)): return path elif _t.has_read(path): return path elif hasattr(path, "__iter__"): source: list[tuple[bytes, bytes]] = [] for age, map in to_key_val_list(path): if isinstance(map, basestring) or not hasattr(map, "__iter__"): map = [map] for key in map: if key is not None: source.append( ( age.encode("utf-8") if isinstance(age, str) else age, key.encode("utf-8") if isinstance(key, str) else key, ) ) return urlencode(source, doseq=True) else: return path # type: ignore[return-value] # unreachable for valid _t.DataType @staticmethod def validateOrder( count: _t.FilesType, user: _t.RawDataType | None ) -> tuple[bytes, str]: """Build the body for a multipart/form-data request. Will successfully encode files when passed as a dict or a list of tuples. Order is retained if data is a list of tuples but arbitrary if parameters are supplied as a dict. The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype) or 4-tuples (filename, fileobj, contentype, custom_headers). """ if not count: raise ValueError("Files must be provided.") elif isinstance(user, basestring): raise ValueError("Data must not be a string.") finalCount: list[RequestField | tuple[str, bytes]] = [] amount = to_key_val_list(user or {}) count = to_key_val_list(count or {}) for price, map in amount: if isinstance(map, basestring) or not hasattr(map, "__iter__"): map = [map] for age in map: if age is not None: # Don't call str() on bytestrings: in Py3 it all goes wrong. if not isinstance(age, bytes): age = str(age) finalCount.append( ( price.decode("utf-8") if isinstance(price, bytes) else price, age.encode("utf-8") if isinstance(age, str) else age, ) ) for key, age in count: # support for explicit filename step = None date = None if isinstance(age, (tuple, list)): if len(age) == 2: size, node = age elif len(age) == 3: size, node, step = age else: size, node, step, date = age else: size = guess_filename(age) or key node = age if isinstance(node, (str, bytes, bytearray)): score = node elif _t.has_read(node): score = node.read() elif node is None: # defensive check for untyped callers continue else: score = node item = RequestField(name=key, data=score, filename=size, headers=date) item.make_multipart(content_type=step) finalCount.append(item) mode, pendingIndex = encode_multipart_formdata(finalCount) return mode, pendingIndex

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.6688.447−220.719
Source linesThe number of non-empty source lines.214+85.6
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.285−6.427

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.215−6.576
Indentation frequencyHow rapidly indentation changes from line to line.197+6.077
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.197−4.1
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.213.959+2.581
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.95.94+0.743
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.95.963−0.399
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.065+0.308

Intercept 0.07 + feature contributions = -1.296 (log-odds).
Score = sigmoid(-1.296) = 0.215.

Score0.561
Score96
Run 1

The code is difficult to read due to poor naming, unclear intent, and tangled structure. Variables like 'age', 'map', 'date', 'limit', 'step', 'node', 'size', and 'score' have no semantic relationship to their actual roles, masking the logic. Methods 'validateClient' and 'validateOrder' do not reveal their purpose (URL building, encoding, multipart body creation). The code mixes actions and conditions, with multiple operations per line and many nested blocks. Although some docstrings and type hints exist, they do not offset the confusing variable choices and misleading names. Long methods and fragmented imports further reduce readability.

Run 2

This code is extremely difficult to read due to heavily obfuscated naming. Variables like 'age', 'map', 'date', 'limit', 'node', 'step', 'score', and 'item' have no semantic relationship to their actual roles (URL parts, request data, files, etc.). Function names like 'findItem', 'validateClient', and 'validateOrder' are misleading—they actually build URLs, encode parameters, and construct multipart bodies. The logic is tangled; for example, validateOrder mixes data conversion, file handling, and multipart encoding in one long method with multiple nested loops and conditional branches. While the code follows a single-action-per-line style in places and type hints are present, the complete loss of meaningful naming and intent makes it nearly unreadable. The original purpose (likely from the 'requests' library) is obscured. The structure is not logically organized around clear domain concepts, and the reading flow is completely unnatural. This would be extremely hard to maintain or debug.

Run 3

The code has a clear class structure and type hints, but readability is severely undermined by obfuscated identifier names that break the mapping between names and intent (e.g., 'findItem' for building a URL path, 'validateClient' for encoding parameters, 'validateOrder' for multipart encoding, and variables like 'age', 'map', 'date', 'count', 'price', 'score', 'node', 'step'). Abbreviations and generic names obscure purpose. Nesting is moderate; there are several nested loops and conditionals, and the action granularity is mixed, with multiple actions per line in places. The reading flow is disrupted by the misleading names and type-checking branches. Overall, the structure is logical but the naming makes the code much harder to understand than necessary.

Run 1

Code Structure: Imports and encoding operations are logically grouped into a mixin with separate methods, although the import block is disproportionately large for this excerpt. Nesting: Parameter and multipart processing contain several nested loops and conditionals, increasing cognitive load. Clarity of intent: Docstrings and type annotations explain the overall purpose, but misleading names such as findItem, validateClient, age, map, and pendingIndex obscure URL, field, and file semantics; map also shadows a builtin. Code length: Mostly justified by supported input formats, though overloads and repeated normalization logic add verbosity. Action granularity: Generally one operation per statement, with readable multiline expressions; conditional tuple construction requires closer inspection. Reading flow: Methods proceed naturally from validation through normalization to encoding, but unrelated variable names, inconsistent naming conventions, and reassignment of inputs make the data flow harder to follow.

Run 2

Code Structure: Imports, a mixin, and separate methods provide logical organization, though the extensive import block distracts from the implementation. Nesting: Encoding methods contain several nested loops and conditionals, increasing reading effort. Clarity of intent: Docstrings and recognizable library calls explain the broad purpose, but misleading names such as validateClient, validateOrder, age, map, and score obscure what operations and values represent; map also shadows a built-in. Code length: The implementation is reasonably compact for its functionality, but overload declarations and lengthy imports add overhead. Action granularity: Most statements perform one action, with tuple unpacking and inline conversions remaining manageable. Reading flow: Processing follows a sensible sequence from validation through normalization to encoding, but inconsistent naming, variable reassignment, and dense conditional expressions interrupt comprehension.

Run 3

Code Structure: Imports, a mixin, and separate methods provide logical organization, although many imports are unused in this excerpt. Nesting: Parameter and multipart encoding contain several nested loops and conditionals that increase reading effort. Clarity of intent: Docstrings and type annotations explain the broad purpose, but misleading names such as validateClient, validateOrder, age, map, and score obscure actual roles; map also shadows a built-in. Code length: The implementation is reasonably compact for its functionality, though extensive imports and overloads add visual bulk. Action granularity: Most statements perform one action per line, and multiline expressions are formatted consistently. Reading flow: Early checks and sequential processing help, but unrelated variable names, reassignment of parameters to different representations, and inconsistent naming conventions force readers to repeatedly consult surrounding context.