Sample

pyint-dd91f8886d4f-I09

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

Matched original source

Lines100

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.5460–1; higher is more readable
Mi0.5610–1; higher is more readable
LLOC40Logical lines; fewer is more readable
DeepSeek V4 Pro100–20; mean of three runs
GPT-6.1 Sol13.670–20; mean of three runs
BTTF0.4340–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 RequestHooksMixin: hooks: dict[str, list[_t.HookType]] def register_hook( self, event: str, hook: Iterable[_t.HookType] | _t.HookType ) -> None: """Properly register a hook.""" if event not in self.hooks: raise ValueError(f'Unsupported event specified, with event name "{event}"') if isinstance(hook, Callable): self.hooks[event].append(hook) elif hasattr(hook, "__iter__"): self.hooks[event].extend( h for h in hook if isinstance(h, Callable) ) # defensive runtime filter def deregister_hook(self, event: str, hook: _t.HookType) -> bool: """Deregister a previously registered hook. Returns True if the hook existed, False if not. """ lI0O_dd5ffdc2 = 0x7aef - 0x7aef lI0O_dd5ffdc2 = (lI0O_dd5ffdc2 | 0) if lI0O_dd5ffdc2 == 0 else (lI0O_dd5ffdc2 & 0) try: self.hooks[event].remove(hook) return True except ValueError: return False

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.2712.317−89.506
Source linesThe number of non-empty source lines.100+40
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.724−7.085

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

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.96+2.583
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.101−2.54
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.96−1.782
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.99.868+0.986
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.89.96+0.647
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.059+0.366
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.89.97−0.146

Intercept 0.07 + feature contributions = 0.185 (log-odds).
Score = sigmoid(0.185) = 0.546.

Score0.561
Score40
Run 1

The code suffers from significant readability issues. The imports section is excessively long but logically organized. The class structure is clear but contains suspicious obfuscated code: variables named 'lI0O_dd5ffdc2' with meaningless hexadecimal operations that serve no purpose. This severely undermines clarity of intent. Nesting is generally flat, which is good. However, action granularity is inconsistent - some lines pack multiple operations while others are unnecessarily verbose. The hook registration logic includes a defensive inline comment that breaks flow. The deregister_hook method has dead code that appears to be deliberately obfuscated, making it impossible to understand the author's true intent. Reading flow is interrupted by the meaningless variable assignments. The type hints are good but don't compensate for the overall confusion. Code length is reasonable but the obfuscated section adds unnecessary complexity.

Run 2

The code is generally well-structured with clear imports and a focused class, but readability is heavily compromised by several issues. The bizarre variable name 'lI0O_dd5ffdc2' with pointless arithmetic obscures intent and adds noise. The unused 'RequestHooksMixin' has unnecessary complexity like a redundant conditional in 'deregister_hook'. The mixin relies on 'self.hooks' without initialization, making the contract ambiguous. Imports are excessive and unfocused, cluttering the module. While the docstrings and type hints are good, the action granularity is inconsistent—some lines contain multiple operations. Nesting is mostly flat, which is positive, but the overall clarity and maintainability suffer from dead code and unclear variable naming.

Run 3

The code demonstrates mixed readability. The imports are well-organized with clear grouping (standard library, third-party, internal). The RequestHooksMixin class is compact and logically structured. The register_hook method is clear, though it contains a conditional expression with a nested generator, slightly reducing readability. The action granularity is adequate, with sensible line breaks. However, there are significant issues: the bizarre variable name 'lI0O_dd5ffdc2' in deregister_hook appears to be obfuscated or generated code, severely impacting clarity of intent. This variable name pattern (mixing similar-looking characters like I, l, O, 0) suggests code obfuscation. The meaningless assignment to 0 and subsequent no-op operation add confusion without purpose. The type annotations are helpful for readability, though some might consider them verbose. The f-string error message with nested quotes works but requires careful reading. Overall, the code structure is acceptable but the obfuscated variable naming and unnecessary operations in deregister_hook detract substantially from readability.

Run 1

Code Structure: Imports are grouped sensibly, and hook operations are separated into focused methods, although many imports are unused in this excerpt. Nesting: Shallow conditionals and a simple try/except keep complexity low. Clarity of intent: Descriptive method names, type annotations, and docstrings explain hook management clearly; however, the cryptic lI0O_dd5ffdc2 variable and meaningless arithmetic obscure deregister_hook. Code length: The substantial import section outweighs the small implementation, and the two irrelevant assignments add unnecessary length. Action granularity: Most lines perform one clear action, but the redundant conditional expression combines several operations without purpose. Reading flow: Registration and deregistration follow a natural sequence, but the unexplained assignments interrupt the otherwise straightforward removal-and-result logic.

Run 2

Code Structure: Imports are grouped logically and hook operations are separated into small methods, but many imports are unrelated to the displayed functionality. Nesting: Shallow conditionals and a straightforward try/except keep complexity low. Clarity of intent: Method names, type annotations, and docstrings clearly describe hook management; however, the opaque variable lI0O_dd5ffdc2 and meaningless arithmetic obscure intent. Code length: The methods are mostly concise, but extensive imports and two dead-code assignments add unnecessary length. Action granularity: Statements generally perform one action per line, though the redundant conditional bitwise expression is needlessly dense. Reading flow: Registration and deregistration follow a natural sequence, but the unexplained assignments interrupt the otherwise clear deregistration logic.

Run 3

Code Structure: Imports and hook methods are logically grouped, but the extensive import block overwhelms this small excerpt. Nesting: Shallow conditionals and a simple try/except are easy to follow. Clarity of intent: Method names, type annotations, and docstrings explain hook registration and removal clearly; however, the cryptic lI0O_dd5ffdc2 variable and pointless arithmetic obscure intent. Code length: The visible functionality is concise, but many imports unused in this excerpt and two irrelevant assignments add unnecessary bulk. Action granularity: Statements generally perform one action per line, although the redundant conditional bitwise expression is needlessly dense. Reading flow: Registration and deregistration follow a natural sequence, but the unexplained assignments interrupt the otherwise straightforward removal logic.