blackbull.utils¶
blackbull.utils
¶
Shared utilities and enumerations.
Scheme
¶
Bases: StrEnum
Which of the two request kinds a route serves.
Passed to @app.route(scheme=...) and matched against a request's
Connection.type. It names the shape of the exchange, not the URL
scheme: http covers both plaintext and TLS, and HTTP/1.1, HTTP/2 and
gRPC alike, because all of them are one request and one response.
websocket is the long-lived one, which is why it routes separately.
A StrEnum, so Scheme.http == 'http' holds and either spelling can
be handed to the router.
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.