tigrbl-base 0.4.4.dev1__tar.gz → 0.4.4.dev8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/PKG-INFO +1 -1
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/pyproject.toml +1 -1
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/__init__.py +2 -0
- tigrbl_base-0.4.4.dev8/tigrbl_base/_base/_headers_base.py +85 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_response_base.py +4 -11
- tigrbl_base-0.4.4.dev1/tigrbl_base/_base/_headers_base.py +0 -12
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/LICENSE +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/NOTICE +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/README.md +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_alias_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_app_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_assembly.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_binding_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_column_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_datatype_lowering.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_engine_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_engine_provider_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_hook_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_mapping_access.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_middleware_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_op_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_request_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_rest_map.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_router_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_rpc_map.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_schema_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_security_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_session_abc.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_session_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_storage.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_table_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_table_registry_base.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/column/__init__.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/column/infer/__init__.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/column/infer/core.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/column/infer/jsonhints.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/column/infer/planning.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/column/infer/types.py +0 -0
- {tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/column/infer/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tigrbl-base
|
|
3
|
-
Version: 0.4.4.
|
|
3
|
+
Version: 0.4.4.dev8
|
|
4
4
|
Summary: Base contract package for Tigrbl apps, routers, tables, sessions, middleware, requests, responses, bindings, and engine interfaces.
|
|
5
5
|
License: Apache License
|
|
6
6
|
Version 2.0, January 2004
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "tigrbl-base"
|
|
3
|
-
version = "0.4.4.
|
|
3
|
+
version = "0.4.4.dev8"
|
|
4
4
|
description = "Base contract package for Tigrbl apps, routers, tables, sessions, middleware, requests, responses, bindings, and engine interfaces."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = { file = "LICENSE" }
|
|
@@ -13,6 +13,8 @@ _EXPORTS = {
|
|
|
13
13
|
"AliasBase": "_alias_base",
|
|
14
14
|
"EngineBase": "_engine_base",
|
|
15
15
|
"EngineProviderBase": "_engine_provider_base",
|
|
16
|
+
"HeaderCookiesBase": "_headers_base",
|
|
17
|
+
"HeadersBase": "_headers_base",
|
|
16
18
|
"HookBase": "_hook_base",
|
|
17
19
|
"RouterBase": "_router_base",
|
|
18
20
|
"ForeignKeyBase": "_storage",
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterable, Mapping
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from tigrbl_core._spec.headers_spec import HeadersSpec
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
HeaderInput = Iterable[tuple[str, str]] | Mapping[str, str] | HeadersSpec | None
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _normalize_header_name(name: Any) -> str:
|
|
13
|
+
if isinstance(name, (bytes, bytearray)):
|
|
14
|
+
return name.decode("latin-1").lower()
|
|
15
|
+
return str(name).lower()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _normalize_header_value(value: Any) -> str:
|
|
19
|
+
if isinstance(value, (bytes, bytearray)):
|
|
20
|
+
return value.decode("latin-1")
|
|
21
|
+
return str(value)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _iter_header_items(values: HeaderInput):
|
|
25
|
+
if values is None:
|
|
26
|
+
return ()
|
|
27
|
+
if isinstance(values, HeadersSpec):
|
|
28
|
+
return values.values.items()
|
|
29
|
+
if hasattr(values, "items"):
|
|
30
|
+
return values.items() # type: ignore[union-attr]
|
|
31
|
+
return values
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class HeadersBase(dict[str, str]):
|
|
35
|
+
"""Base header mapping type for response implementations."""
|
|
36
|
+
|
|
37
|
+
required: tuple[str, ...]
|
|
38
|
+
expose: tuple[str, ...]
|
|
39
|
+
|
|
40
|
+
def __init__(
|
|
41
|
+
self,
|
|
42
|
+
values: HeaderInput = None,
|
|
43
|
+
*,
|
|
44
|
+
required: tuple[str, ...] = (),
|
|
45
|
+
expose: tuple[str, ...] = (),
|
|
46
|
+
) -> None:
|
|
47
|
+
if isinstance(values, HeadersSpec):
|
|
48
|
+
required = values.required
|
|
49
|
+
expose = values.expose
|
|
50
|
+
super().__init__(
|
|
51
|
+
{
|
|
52
|
+
_normalize_header_name(key): _normalize_header_value(value)
|
|
53
|
+
for key, value in _iter_header_items(values)
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
self.required = tuple(_normalize_header_name(name) for name in required)
|
|
57
|
+
self.expose = tuple(_normalize_header_name(name) for name in expose)
|
|
58
|
+
|
|
59
|
+
def __getitem__(self, key: str) -> str:
|
|
60
|
+
return super().__getitem__(_normalize_header_name(key))
|
|
61
|
+
|
|
62
|
+
def __contains__(self, key: object) -> bool:
|
|
63
|
+
if isinstance(key, (str, bytes, bytearray)):
|
|
64
|
+
return super().__contains__(_normalize_header_name(key))
|
|
65
|
+
return super().__contains__(key)
|
|
66
|
+
|
|
67
|
+
def get(self, key: str, default: Any = None) -> str | Any:
|
|
68
|
+
return super().get(_normalize_header_name(key), default)
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def raw_headers(self) -> list[tuple[bytes, bytes]]:
|
|
72
|
+
return [
|
|
73
|
+
(key.encode("latin-1"), value.encode("latin-1"))
|
|
74
|
+
for key, value in self.items()
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
def as_spec(self) -> HeadersSpec:
|
|
78
|
+
return HeadersSpec(values=dict(self), required=self.required, expose=self.expose)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class HeaderCookiesBase(dict[str, str]):
|
|
82
|
+
"""Base cookie mapping type for response implementations."""
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
__all__ = ["HeaderCookiesBase", "HeadersBase"]
|
|
@@ -38,18 +38,13 @@ class ResponseBase(ResponseSpec):
|
|
|
38
38
|
payload = (
|
|
39
39
|
body if body is not None else (content if content is not None else b"")
|
|
40
40
|
)
|
|
41
|
-
|
|
42
|
-
str(key).lower(): str(value)
|
|
43
|
-
for key, value in (
|
|
44
|
-
headers.items() if hasattr(headers, "items") else (headers or [])
|
|
45
|
-
)
|
|
46
|
-
}
|
|
41
|
+
headers_base = HeadersBase(headers)
|
|
47
42
|
|
|
48
43
|
super().__init__(
|
|
49
44
|
kind=kind,
|
|
50
45
|
media_type=media_type,
|
|
51
46
|
status_code=status_code,
|
|
52
|
-
headers=dict(
|
|
47
|
+
headers=dict(headers_base),
|
|
53
48
|
envelope=envelope,
|
|
54
49
|
template=template,
|
|
55
50
|
filename=filename,
|
|
@@ -59,15 +54,13 @@ class ResponseBase(ResponseSpec):
|
|
|
59
54
|
redirect_to=redirect_to,
|
|
60
55
|
)
|
|
61
56
|
self.status_code = status_code
|
|
62
|
-
self.headers: HeadersBase =
|
|
57
|
+
self.headers: HeadersBase = headers_base
|
|
63
58
|
self.body = payload
|
|
64
59
|
self.media_type = media_type
|
|
65
60
|
|
|
66
61
|
@property
|
|
67
62
|
def raw_headers(self) -> list[tuple[bytes, bytes]]:
|
|
68
|
-
return
|
|
69
|
-
(k.encode("latin-1"), v.encode("latin-1")) for k, v in self.headers.items()
|
|
70
|
-
]
|
|
63
|
+
return self.headers.raw_headers
|
|
71
64
|
|
|
72
65
|
@property
|
|
73
66
|
def headers_map(self) -> HeadersBase:
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class HeadersBase(dict[str, str]):
|
|
5
|
-
"""Base header mapping type for response implementations."""
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class HeaderCookiesBase(dict[str, str]):
|
|
9
|
-
"""Base cookie mapping type for response implementations."""
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
__all__ = ["HeaderCookiesBase", "HeadersBase"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tigrbl_base-0.4.4.dev1 → tigrbl_base-0.4.4.dev8}/tigrbl_base/_base/_engine_provider_base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|