blackbull.utils¶
blackbull.utils
¶
Shared utilities and enumerations.
Provides:
Scheme:StrEnumwithhttpandwebsocketvalues used throughout routing.pop_safe: moves a key between dicts with an optional rename, no-op when absent.do_nothing: awaitable no-op used as the innermost middleware-chain terminator.HTTP2: the HTTP/2 client connection preface (RFC 9113 ยง3.4).is_client_error/is_server_error: 3.11-safe HTTP status classifiers.
is_client_error(status)
¶
True for a 4xx status (RFC 9110 client error). 3.11-safe replacement
for HTTPStatus.is_client_error (which is 3.12+).
is_server_error(status)
¶
True for a 5xx status (RFC 9110 server error). 3.11-safe replacement
for HTTPStatus.is_server_error (which is 3.12+).
pop_safe(key, source, target, *, new_key=None)
¶
Move source[key] into target (under new_key if given), if present.
Returns target unchanged when key is absent from source.