appier 1.34.12__tar.gz → 1.35.1__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.
- {appier-1.34.12/src/appier.egg-info → appier-1.35.1}/PKG-INFO +1 -1
- {appier-1.34.12 → appier-1.35.1}/setup.py +1 -1
- {appier-1.34.12 → appier-1.35.1}/src/appier/__init__.py +10 -1
- appier-1.35.1/src/appier/amqp.pyi +14 -0
- appier-1.35.1/src/appier/api.pyi +168 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/asgi.py +8 -1
- appier-1.35.1/src/appier/asgi.pyi +74 -0
- appier-1.35.1/src/appier/bus.pyi +54 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/config.py +26 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/geo.py +9 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/graph.py +1 -1
- {appier-1.34.12 → appier-1.35.1}/src/appier/model.pyi +12 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/storage.py +43 -20
- appier-1.35.1/src/appier/storage.pyi +61 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/smtp.py +2 -5
- appier-1.35.1/src/appier/test/storage.py +305 -0
- appier-1.35.1/src/appier/typesf.pyi +104 -0
- {appier-1.34.12 → appier-1.35.1/src/appier.egg-info}/PKG-INFO +1 -1
- {appier-1.34.12 → appier-1.35.1}/src/appier.egg-info/SOURCES.txt +6 -0
- appier-1.34.12/src/appier/bus.pyi +0 -8
- {appier-1.34.12 → appier-1.35.1}/MANIFEST.in +0 -0
- {appier-1.34.12 → appier-1.35.1}/README.rst +0 -0
- {appier-1.34.12 → appier-1.35.1}/pyproject.toml +0 -0
- {appier-1.34.12 → appier-1.35.1}/setup.cfg +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/amqp.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/api.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/async_neo.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/async_old.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/asynchronous.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/asynchronous.pyi +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/base.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/base.pyi +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/bus.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/cache.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/cache.pyi +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/common.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/component.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/component.pyi +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/compress.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/controller.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/crypt.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/data.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/data.pyi +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/defines.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/exceptions.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/execution.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/export.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/extra.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/extra_neo.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/extra_old.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/git.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/http.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/legacy.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/log.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/meta.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/mock.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/model.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/model_a.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/mongo.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/observer.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/part.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/part.pyi +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/preferences.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/preferences.pyi +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/queuing.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/redisdb.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/request.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/res/static/css/base.css +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/res/static/images/favicon.ico +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/res/static/js/base.js +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/res/templates/error.html.tpl +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/res/templates/holder.html.tpl +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/res/templates/layout.html.tpl +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/scheduler.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/scheduler.pyi +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/serialize.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/session.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/session.pyi +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/settings.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/smtp.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/structures.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/__init__.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/base.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/cache.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/config.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/crypt.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/data.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/error_handler.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/exception_handler.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/exceptions.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/export.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/graph.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/http.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/legacy.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/log.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/mock.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/model.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/part.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/preferences.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/queuing.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/request.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/scheduler.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/serialize.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/session.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/structures.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/tags.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/typesf.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/util.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/test/validation.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/typesf.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/util.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier/validation.py +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier.egg-info/dependency_links.txt +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier.egg-info/not-zip-safe +0 -0
- {appier-1.34.12 → appier-1.35.1}/src/appier.egg-info/top_level.txt +0 -0
|
@@ -144,7 +144,16 @@ from .bus import Bus, MemoryBus, RedisBus
|
|
|
144
144
|
from .cache import Cache, MemoryCache, FileCache, RedisCache, SerializedCache
|
|
145
145
|
from .component import Component
|
|
146
146
|
from .compress import Compress
|
|
147
|
-
from .config import
|
|
147
|
+
from .config import (
|
|
148
|
+
conf,
|
|
149
|
+
conf_prefix,
|
|
150
|
+
conf_suffix,
|
|
151
|
+
conf_s,
|
|
152
|
+
conf_r,
|
|
153
|
+
conf_d,
|
|
154
|
+
conf_ctx,
|
|
155
|
+
conf_override,
|
|
156
|
+
)
|
|
148
157
|
from .controller import Controller
|
|
149
158
|
from .crypt import Cipher, RC4, Spritz
|
|
150
159
|
from .data import (
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
URL: str
|
|
4
|
+
TIMEOUT: int
|
|
5
|
+
connection: Any | None
|
|
6
|
+
|
|
7
|
+
class AMQP:
|
|
8
|
+
url: str | None
|
|
9
|
+
_connection: Any | None
|
|
10
|
+
def __init__(self, url: str | None = ...): ...
|
|
11
|
+
def get_connection(self, url: str | None = ..., timeout: int = ...) -> Any: ...
|
|
12
|
+
|
|
13
|
+
def get_connection(url: str = ..., timeout: int = ...) -> Any: ...
|
|
14
|
+
def properties(*args, **kwargs) -> Any: ...
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
from typing import Any, Callable, Self
|
|
2
|
+
|
|
3
|
+
from .base import App
|
|
4
|
+
from .observer import Observable
|
|
5
|
+
|
|
6
|
+
class API(Observable):
|
|
7
|
+
SINGLETON: Self | None
|
|
8
|
+
owner: App
|
|
9
|
+
auth_callback: Callable | None
|
|
10
|
+
def __init__(self, owner: App = ..., *args, **kwargs): ...
|
|
11
|
+
@classmethod
|
|
12
|
+
def singleton(cls, *args, **kwargs) -> Self: ...
|
|
13
|
+
def get(
|
|
14
|
+
self,
|
|
15
|
+
url: str,
|
|
16
|
+
headers: dict[str, Any] | None = ...,
|
|
17
|
+
params: dict[str, Any] | None = ...,
|
|
18
|
+
handle: bool | None = ...,
|
|
19
|
+
silent: bool | None = ...,
|
|
20
|
+
redirect: bool | None = ...,
|
|
21
|
+
timeout: int | float | None = ...,
|
|
22
|
+
callback: bool = ...,
|
|
23
|
+
extra: dict[str, Any] | None = ...,
|
|
24
|
+
**kwargs
|
|
25
|
+
) -> Any: ...
|
|
26
|
+
def post(
|
|
27
|
+
self,
|
|
28
|
+
url: str,
|
|
29
|
+
data: Any = ...,
|
|
30
|
+
data_j: Any = ...,
|
|
31
|
+
data_m: Any = ...,
|
|
32
|
+
headers: dict[str, Any] | None = ...,
|
|
33
|
+
params: dict[str, Any] | None = ...,
|
|
34
|
+
mime: str | None = ...,
|
|
35
|
+
handle: bool | None = ...,
|
|
36
|
+
silent: bool | None = ...,
|
|
37
|
+
redirect: bool | None = ...,
|
|
38
|
+
timeout: int | float | None = ...,
|
|
39
|
+
callback: bool = ...,
|
|
40
|
+
extra: dict[str, Any] | None = ...,
|
|
41
|
+
**kwargs
|
|
42
|
+
) -> Any: ...
|
|
43
|
+
def put(
|
|
44
|
+
self,
|
|
45
|
+
url: str,
|
|
46
|
+
data: Any = ...,
|
|
47
|
+
data_j: Any = ...,
|
|
48
|
+
data_m: Any = ...,
|
|
49
|
+
headers: dict[str, Any] | None = ...,
|
|
50
|
+
params: dict[str, Any] | None = ...,
|
|
51
|
+
mime: str | None = ...,
|
|
52
|
+
handle: bool | None = ...,
|
|
53
|
+
silent: bool | None = ...,
|
|
54
|
+
redirect: bool | None = ...,
|
|
55
|
+
timeout: int | float | None = ...,
|
|
56
|
+
callback: bool = ...,
|
|
57
|
+
extra: dict[str, Any] | None = ...,
|
|
58
|
+
**kwargs
|
|
59
|
+
) -> Any: ...
|
|
60
|
+
def delete(
|
|
61
|
+
self,
|
|
62
|
+
url: str,
|
|
63
|
+
headers: dict[str, Any] | None = ...,
|
|
64
|
+
params: dict[str, Any] | None = ...,
|
|
65
|
+
handle: bool | None = ...,
|
|
66
|
+
silent: bool | None = ...,
|
|
67
|
+
redirect: bool | None = ...,
|
|
68
|
+
timeout: int | float | None = ...,
|
|
69
|
+
callback: bool = ...,
|
|
70
|
+
extra: dict[str, Any] | None = ...,
|
|
71
|
+
**kwargs
|
|
72
|
+
) -> Any: ...
|
|
73
|
+
def patch(
|
|
74
|
+
self,
|
|
75
|
+
url: str,
|
|
76
|
+
data: Any = ...,
|
|
77
|
+
data_j: Any = ...,
|
|
78
|
+
data_m: Any = ...,
|
|
79
|
+
headers: dict[str, Any] | None = ...,
|
|
80
|
+
params: dict[str, Any] | None = ...,
|
|
81
|
+
mime: str | None = ...,
|
|
82
|
+
handle: bool | None = ...,
|
|
83
|
+
silent: bool | None = ...,
|
|
84
|
+
redirect: bool | None = ...,
|
|
85
|
+
timeout: int | float | None = ...,
|
|
86
|
+
callback: bool = ...,
|
|
87
|
+
extra: dict[str, Any] | None = ...,
|
|
88
|
+
**kwargs
|
|
89
|
+
) -> Any: ...
|
|
90
|
+
def request(self, method: Callable, *args, **kwargs) -> Any: ...
|
|
91
|
+
def build( # pyright: ignore[reportIncompatibleMethodOverride]
|
|
92
|
+
self,
|
|
93
|
+
method: str,
|
|
94
|
+
url: str,
|
|
95
|
+
data: Any = ...,
|
|
96
|
+
data_j: Any = ...,
|
|
97
|
+
data_m: Any = ...,
|
|
98
|
+
headers: dict[str, Any] | None = ...,
|
|
99
|
+
params: dict[str, Any] | None = ...,
|
|
100
|
+
mime: str | None = ...,
|
|
101
|
+
kwargs: dict[str, Any] | None = ...,
|
|
102
|
+
) -> None: ...
|
|
103
|
+
def handle_error(self, error: Exception) -> None: ...
|
|
104
|
+
@property
|
|
105
|
+
def logger(self) -> Any: ...
|
|
106
|
+
|
|
107
|
+
class OAuthAPI(API):
|
|
108
|
+
DIRECT_MODE: int
|
|
109
|
+
OAUTH_MODE: int
|
|
110
|
+
UNSET_MODE: int
|
|
111
|
+
mode: int
|
|
112
|
+
def __init__(self, *args, **kwargs): ...
|
|
113
|
+
def handle_error(self, error: Exception) -> None: ...
|
|
114
|
+
def is_direct(self) -> bool: ...
|
|
115
|
+
def is_oauth(self) -> bool: ...
|
|
116
|
+
def _get_mode(self) -> int: ...
|
|
117
|
+
|
|
118
|
+
class OAuth1API(OAuthAPI):
|
|
119
|
+
oauth_token: str | None
|
|
120
|
+
oauth_token_secret: str | None
|
|
121
|
+
client_key: str | None
|
|
122
|
+
client_secret: str | None
|
|
123
|
+
def __init__(self, *args, **kwargs): ...
|
|
124
|
+
def build(
|
|
125
|
+
self,
|
|
126
|
+
method: str,
|
|
127
|
+
url: str,
|
|
128
|
+
data: Any = ...,
|
|
129
|
+
data_j: Any = ...,
|
|
130
|
+
data_m: Any = ...,
|
|
131
|
+
headers: dict[str, Any] | None = ...,
|
|
132
|
+
params: dict[str, Any] | None = ...,
|
|
133
|
+
mime: str | None = ...,
|
|
134
|
+
kwargs: dict[str, Any] | None = ...,
|
|
135
|
+
) -> None: ...
|
|
136
|
+
def auth_header(
|
|
137
|
+
self,
|
|
138
|
+
method: str,
|
|
139
|
+
url: str,
|
|
140
|
+
headers: dict[str, Any],
|
|
141
|
+
kwargs: dict[str, Any],
|
|
142
|
+
sign_method: str = ...,
|
|
143
|
+
) -> None: ...
|
|
144
|
+
@property
|
|
145
|
+
def auth_default(self) -> bool: ...
|
|
146
|
+
|
|
147
|
+
class OAuth2API(OAuthAPI):
|
|
148
|
+
access_token: str | None
|
|
149
|
+
def __init__(self, *args, **kwargs): ...
|
|
150
|
+
def build(
|
|
151
|
+
self,
|
|
152
|
+
method: str,
|
|
153
|
+
url: str,
|
|
154
|
+
data: Any = ...,
|
|
155
|
+
data_j: Any = ...,
|
|
156
|
+
data_m: Any = ...,
|
|
157
|
+
headers: dict[str, Any] | None = ...,
|
|
158
|
+
params: dict[str, Any] | None = ...,
|
|
159
|
+
mime: str | None = ...,
|
|
160
|
+
kwargs: dict[str, Any] | None = ...,
|
|
161
|
+
) -> None: ...
|
|
162
|
+
def get_access_token(self) -> str: ...
|
|
163
|
+
@property
|
|
164
|
+
def oauth_types(self) -> tuple[str, ...]: ...
|
|
165
|
+
@property
|
|
166
|
+
def oauth_param(self) -> str: ...
|
|
167
|
+
@property
|
|
168
|
+
def token_default(self) -> bool: ...
|
|
@@ -189,9 +189,16 @@ class ASGIApp(object):
|
|
|
189
189
|
self._ensure_start(ctx, start_response)
|
|
190
190
|
await ctx["start_task"]
|
|
191
191
|
|
|
192
|
+
# ensures the result is a sequence for iteration and if it's
|
|
193
|
+
# not initializes it as an empty list, notice the special case
|
|
194
|
+
# of a string that should be converted into a single element list
|
|
195
|
+
result = result if result else []
|
|
196
|
+
if legacy.is_string(result):
|
|
197
|
+
result = [result]
|
|
198
|
+
|
|
192
199
|
# iterates over the complete set of chunks in the response
|
|
193
200
|
# iterator to send each of them to the client side
|
|
194
|
-
for chunk in result
|
|
201
|
+
for chunk in result:
|
|
195
202
|
if asyncio.iscoroutine(chunk):
|
|
196
203
|
await chunk
|
|
197
204
|
elif asyncio.isfuture(chunk):
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
from typing import Any, Callable, Coroutine
|
|
2
|
+
|
|
3
|
+
class ASGIApp:
|
|
4
|
+
_asgi: ASGIApp | None
|
|
5
|
+
server_version: str | None
|
|
6
|
+
_server: Any | None
|
|
7
|
+
@classmethod
|
|
8
|
+
async def asgi_entry(
|
|
9
|
+
cls,
|
|
10
|
+
scope: dict[str, Any],
|
|
11
|
+
receive: Callable[[], Coroutine[Any, Any, dict[str, Any]]],
|
|
12
|
+
send: Callable[[dict[str, Any]], Coroutine[Any, Any, None]],
|
|
13
|
+
) -> None: ...
|
|
14
|
+
def serve_uvicorn(self, host: str, port: int, **kwargs) -> None: ...
|
|
15
|
+
def serve_hypercorn(
|
|
16
|
+
self,
|
|
17
|
+
host: str,
|
|
18
|
+
port: int,
|
|
19
|
+
ssl: bool = ...,
|
|
20
|
+
key_file: str | None = ...,
|
|
21
|
+
cer_file: str | None = ...,
|
|
22
|
+
**kwargs
|
|
23
|
+
) -> None: ...
|
|
24
|
+
def serve_daphne(self, host: str, port: int, **kwargs) -> None: ...
|
|
25
|
+
async def send(self, data: Any, content_type: str | None = ...) -> Any: ...
|
|
26
|
+
async def app_asgi(self, *args, **kwargs) -> Any: ...
|
|
27
|
+
async def application_asgi(
|
|
28
|
+
self,
|
|
29
|
+
scope: dict[str, Any],
|
|
30
|
+
receive: Callable[[], Coroutine[Any, Any, dict[str, Any]]],
|
|
31
|
+
send: Callable[[dict[str, Any]], Coroutine[Any, Any, None]],
|
|
32
|
+
) -> None: ...
|
|
33
|
+
async def asgi_lifespan(
|
|
34
|
+
self,
|
|
35
|
+
scope: dict[str, Any],
|
|
36
|
+
receive: Callable[[], Coroutine[Any, Any, dict[str, Any]]],
|
|
37
|
+
send: Callable[[dict[str, Any]], Coroutine[Any, Any, None]],
|
|
38
|
+
) -> None: ...
|
|
39
|
+
async def asgi_http(
|
|
40
|
+
self,
|
|
41
|
+
scope: dict[str, Any],
|
|
42
|
+
receive: Callable[[], Coroutine[Any, Any, dict[str, Any]]],
|
|
43
|
+
send: Callable[[dict[str, Any]], Coroutine[Any, Any, None]],
|
|
44
|
+
) -> None: ...
|
|
45
|
+
async def _build_start_response(
|
|
46
|
+
self,
|
|
47
|
+
ctx: dict[str, Any],
|
|
48
|
+
send: Callable[[dict[str, Any]], Coroutine[Any, Any, None]],
|
|
49
|
+
) -> Callable[[str, list[tuple[str, str]]], None]: ...
|
|
50
|
+
async def _build_sender(
|
|
51
|
+
self,
|
|
52
|
+
ctx: dict[str, Any],
|
|
53
|
+
send: Callable[[dict[str, Any]], Coroutine[Any, Any, None]],
|
|
54
|
+
start_response: Callable[[str, list[tuple[str, str]]], None],
|
|
55
|
+
) -> Callable[[Any], Coroutine[Any, Any, None]]: ...
|
|
56
|
+
async def _build_body(
|
|
57
|
+
self,
|
|
58
|
+
receive: Callable[[], Coroutine[Any, Any, dict[str, Any]]],
|
|
59
|
+
max_size: int = ...,
|
|
60
|
+
) -> Any: ...
|
|
61
|
+
async def _build_environ(
|
|
62
|
+
self,
|
|
63
|
+
scope: dict[str, Any],
|
|
64
|
+
body: Any,
|
|
65
|
+
sender: Callable[[Any], Coroutine[Any, Any, None]],
|
|
66
|
+
) -> dict[str, Any]: ...
|
|
67
|
+
def _ensure_start(
|
|
68
|
+
self,
|
|
69
|
+
ctx: dict[str, Any],
|
|
70
|
+
start_response: Callable[[str, list[tuple[str, str]]], None],
|
|
71
|
+
) -> None: ...
|
|
72
|
+
|
|
73
|
+
def build_asgi(app_cls: type[ASGIApp]) -> Callable: ...
|
|
74
|
+
def build_asgi_i(app: ASGIApp) -> Callable: ...
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from threading import Thread
|
|
2
|
+
from typing import Any, Callable, Self, Sequence
|
|
3
|
+
|
|
4
|
+
from .base import App
|
|
5
|
+
from .component import Component
|
|
6
|
+
|
|
7
|
+
class Bus(Component):
|
|
8
|
+
def __init__(self, name: str = ..., owner: App = ..., *args, **kwargs): ...
|
|
9
|
+
@classmethod
|
|
10
|
+
def new(cls, *args, **kwargs) -> Self: ...
|
|
11
|
+
def bind(self, name: str, method: Callable) -> None: ...
|
|
12
|
+
def unbind(self, name: str, method: Callable | None = ...) -> None: ...
|
|
13
|
+
def trigger(self, name: str, *args, **kwargs) -> None: ...
|
|
14
|
+
|
|
15
|
+
class MemoryBus(Bus):
|
|
16
|
+
_events: dict[str, list[Callable]]
|
|
17
|
+
def __init__(self, name: str = ..., owner: App = ..., *args, **kwargs): ...
|
|
18
|
+
def bind(self, name: str, method: Callable) -> None: ...
|
|
19
|
+
def unbind(self, name: str, method: Callable | None = ...) -> None: ...
|
|
20
|
+
def trigger(self, name: str, *args, **kwargs) -> None: ...
|
|
21
|
+
def _load(self, *args, **kwargs) -> None: ...
|
|
22
|
+
def _unload(self, *args, **kwargs) -> None: ...
|
|
23
|
+
def _get_state(self) -> dict[str, Sequence[Callable]]: ...
|
|
24
|
+
def _set_state(self, state: dict[str, Sequence[Callable]]) -> None: ...
|
|
25
|
+
|
|
26
|
+
class RedisBus(Bus):
|
|
27
|
+
SERIALIZER: Any
|
|
28
|
+
GLOBAL_CHANNEL: str
|
|
29
|
+
_delay: bool
|
|
30
|
+
_events: dict[str, list[Callable]]
|
|
31
|
+
_name: str
|
|
32
|
+
_serializer: Any
|
|
33
|
+
_global_channel: str
|
|
34
|
+
_redis: Any
|
|
35
|
+
_pubsub: Any
|
|
36
|
+
_listener: RedisListener
|
|
37
|
+
def __init__(self, name: str = ..., owner: App = ..., *args, **kwargs): ...
|
|
38
|
+
def bind(self, name: str, method: Callable) -> None: ...
|
|
39
|
+
def unbind(self, name: str, method: Callable | None = ...) -> None: ...
|
|
40
|
+
def trigger(self, name: str, *args, **kwargs) -> None: ...
|
|
41
|
+
def _load(self, *args, **kwargs) -> None: ...
|
|
42
|
+
def _unload(self, *args, **kwargs) -> None: ...
|
|
43
|
+
def _get_state(self) -> dict[str, Sequence[Callable]]: ...
|
|
44
|
+
def _set_state(self, state: dict[str, Sequence[Callable]]) -> None: ...
|
|
45
|
+
def _open(self) -> None: ...
|
|
46
|
+
def _close(self) -> None: ...
|
|
47
|
+
def _loop(self, safe: bool = ...) -> None: ...
|
|
48
|
+
def _tick(self, item: dict[str, Any], safe: bool = ...) -> None: ...
|
|
49
|
+
def _to_channel(self, name: str) -> str: ...
|
|
50
|
+
|
|
51
|
+
class RedisListener(Thread):
|
|
52
|
+
_bus: RedisBus
|
|
53
|
+
def __init__(self, bus: RedisBus): ...
|
|
54
|
+
def run(self) -> None: ...
|
|
@@ -39,6 +39,7 @@ __license__ = "Apache License, Version 2.0"
|
|
|
39
39
|
import os
|
|
40
40
|
import sys
|
|
41
41
|
import json
|
|
42
|
+
import contextlib
|
|
42
43
|
|
|
43
44
|
from . import legacy
|
|
44
45
|
|
|
@@ -167,6 +168,31 @@ def conf_ctx():
|
|
|
167
168
|
return dict(configs=dict(), config_f=dict())
|
|
168
169
|
|
|
169
170
|
|
|
171
|
+
@contextlib.contextmanager
|
|
172
|
+
def conf_override(name, value):
|
|
173
|
+
"""
|
|
174
|
+
Context manager to temporarily override a configuration value.
|
|
175
|
+
|
|
176
|
+
Saves the original value, sets the new value, and restores the original
|
|
177
|
+
value (or removes it if it was None) when the context exits.
|
|
178
|
+
|
|
179
|
+
:type name: String
|
|
180
|
+
:param name: The name of the configuration key to override.
|
|
181
|
+
:type value: String
|
|
182
|
+
:param value: The temporary value to set for the configuration key.
|
|
183
|
+
"""
|
|
184
|
+
|
|
185
|
+
original = conf(name, None)
|
|
186
|
+
conf_s(name, value)
|
|
187
|
+
try:
|
|
188
|
+
yield
|
|
189
|
+
finally:
|
|
190
|
+
if original == None:
|
|
191
|
+
conf_r(name)
|
|
192
|
+
else:
|
|
193
|
+
conf_s(name, original)
|
|
194
|
+
|
|
195
|
+
|
|
170
196
|
def load(names=(FILE_NAME,), path=None, encoding="utf-8", ctx=None):
|
|
171
197
|
paths = []
|
|
172
198
|
homes = get_homes()
|
|
@@ -38,6 +38,15 @@ from . import legacy
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
class GeoResolver(object):
|
|
41
|
+
"""
|
|
42
|
+
Resolves geo-location information for IP addresses using
|
|
43
|
+
a MaxMind city database that is loaded from disk.
|
|
44
|
+
|
|
45
|
+
The resolver tries known file locations, downloads the
|
|
46
|
+
compressed database when missing and exposes a simplified
|
|
47
|
+
structure for easier consumption.
|
|
48
|
+
"""
|
|
49
|
+
|
|
41
50
|
DB_NAME = "GeoLite2-City.mmdb"
|
|
42
51
|
""" The name of the file that contains the GeoIP
|
|
43
52
|
information database (to be used in execution) """
|
|
@@ -105,7 +105,7 @@ class Graph(object):
|
|
|
105
105
|
queue.push(src, priority=0)
|
|
106
106
|
|
|
107
107
|
while queue.length() > 0:
|
|
108
|
-
|
|
108
|
+
_, _, top = queue.pop(full=True)
|
|
109
109
|
dist[top] = dist[top] if top in dist else defines.INFINITY
|
|
110
110
|
|
|
111
111
|
edges = self.edges[top] if top in self.edges else []
|
|
@@ -42,6 +42,18 @@ class Model:
|
|
|
42
42
|
before_callbacks: Sequence[Callable[[Self], None]] = ...,
|
|
43
43
|
after_callbacks: Sequence[Callable[[Self], None]] = ...,
|
|
44
44
|
) -> Self: ...
|
|
45
|
+
def pre_validate(self) -> None: ...
|
|
46
|
+
def pre_save(self) -> None: ...
|
|
47
|
+
def pre_create(self) -> None: ...
|
|
48
|
+
def pre_update(self) -> None: ...
|
|
49
|
+
def pre_delete(self) -> None: ...
|
|
50
|
+
def post_validate(self) -> None: ...
|
|
51
|
+
def post_save(self) -> None: ...
|
|
52
|
+
def post_create(self) -> None: ...
|
|
53
|
+
def post_update(self) -> None: ...
|
|
54
|
+
def post_delete(self) -> None: ...
|
|
55
|
+
def pre_apply(self) -> None: ...
|
|
56
|
+
def post_apply(self) -> None: ...
|
|
45
57
|
@property
|
|
46
58
|
def identity(self) -> Any: ...
|
|
47
59
|
...
|
|
@@ -53,19 +53,19 @@ class StorageEngine(object):
|
|
|
53
53
|
raise exceptions.NotImplementedError()
|
|
54
54
|
|
|
55
55
|
@classmethod
|
|
56
|
-
def seek(
|
|
56
|
+
def seek(cls, file, *args, **kwargs):
|
|
57
57
|
raise exceptions.NotImplementedError()
|
|
58
58
|
|
|
59
59
|
@classmethod
|
|
60
|
-
def cleanup(
|
|
60
|
+
def cleanup(cls, file, *args, **kwargs):
|
|
61
61
|
raise exceptions.NotImplementedError()
|
|
62
62
|
|
|
63
63
|
@classmethod
|
|
64
|
-
def is_seekable(
|
|
64
|
+
def is_seekable(cls):
|
|
65
65
|
return False
|
|
66
66
|
|
|
67
67
|
@classmethod
|
|
68
|
-
def is_stored(
|
|
68
|
+
def is_stored(cls):
|
|
69
69
|
return False
|
|
70
70
|
|
|
71
71
|
@classmethod
|
|
@@ -75,7 +75,9 @@ class StorageEngine(object):
|
|
|
75
75
|
|
|
76
76
|
class BaseEngine(StorageEngine):
|
|
77
77
|
@classmethod
|
|
78
|
-
def load(
|
|
78
|
+
def load( # pyright: ignore[reportIncompatibleMethodOverride]
|
|
79
|
+
cls, file, *args, **kwargs
|
|
80
|
+
):
|
|
79
81
|
force = kwargs.get("force", False)
|
|
80
82
|
if not file.file_name:
|
|
81
83
|
return
|
|
@@ -92,18 +94,24 @@ class BaseEngine(StorageEngine):
|
|
|
92
94
|
finally:
|
|
93
95
|
handle.close()
|
|
94
96
|
|
|
95
|
-
cls._compute()
|
|
97
|
+
cls._compute(file)
|
|
96
98
|
|
|
97
99
|
@classmethod
|
|
98
|
-
def store(
|
|
100
|
+
def store( # pyright: ignore[reportIncompatibleMethodOverride]
|
|
101
|
+
cls, file, *args, **kwargs
|
|
102
|
+
):
|
|
99
103
|
pass
|
|
100
104
|
|
|
101
105
|
@classmethod
|
|
102
|
-
def delete(
|
|
106
|
+
def delete( # pyright: ignore[reportIncompatibleMethodOverride]
|
|
107
|
+
cls, file, *args, **kwargs
|
|
108
|
+
):
|
|
103
109
|
pass
|
|
104
110
|
|
|
105
111
|
@classmethod
|
|
106
|
-
def read(
|
|
112
|
+
def read( # pyright: ignore[reportIncompatibleMethodOverride]
|
|
113
|
+
cls, file, *args, **kwargs
|
|
114
|
+
):
|
|
107
115
|
# tries to determine the requested size for# the file
|
|
108
116
|
# reading in case none is defined the handled flag
|
|
109
117
|
# handling is ignored and the data returned immediately
|
|
@@ -125,19 +133,23 @@ class BaseEngine(StorageEngine):
|
|
|
125
133
|
return None
|
|
126
134
|
|
|
127
135
|
@classmethod
|
|
128
|
-
def cleanup(
|
|
136
|
+
def cleanup( # pyright: ignore[reportIncompatibleMethodOverride]
|
|
137
|
+
cls, file, *args, **kwargs
|
|
138
|
+
):
|
|
129
139
|
if not hasattr(file, "handled"):
|
|
130
140
|
return
|
|
131
141
|
del file._handled
|
|
132
142
|
|
|
133
143
|
@classmethod
|
|
134
|
-
def is_stored(
|
|
144
|
+
def is_stored(cls): # pyright: ignore[reportIncompatibleMethodOverride]
|
|
135
145
|
return True
|
|
136
146
|
|
|
137
147
|
|
|
138
148
|
class FsEngine(StorageEngine):
|
|
139
149
|
@classmethod
|
|
140
|
-
def store(
|
|
150
|
+
def store( # pyright: ignore[reportIncompatibleMethodOverride]
|
|
151
|
+
cls, file, *args, **kwargs
|
|
152
|
+
):
|
|
141
153
|
file_path = cls._file_path(file)
|
|
142
154
|
file_data = file.data or b""
|
|
143
155
|
handle = open(file_path, "wb")
|
|
@@ -147,16 +159,22 @@ class FsEngine(StorageEngine):
|
|
|
147
159
|
handle.close()
|
|
148
160
|
|
|
149
161
|
@classmethod
|
|
150
|
-
def load(
|
|
162
|
+
def load( # pyright: ignore[reportIncompatibleMethodOverride]
|
|
163
|
+
cls, file, *args, **kwargs
|
|
164
|
+
):
|
|
151
165
|
cls._compute(file)
|
|
152
166
|
|
|
153
167
|
@classmethod
|
|
154
|
-
def delete(
|
|
168
|
+
def delete( # pyright: ignore[reportIncompatibleMethodOverride]
|
|
169
|
+
cls, file, *args, **kwargs
|
|
170
|
+
):
|
|
155
171
|
file_path = cls._file_path(file, ensure=False)
|
|
156
172
|
os.remove(file_path)
|
|
157
173
|
|
|
158
174
|
@classmethod
|
|
159
|
-
def read(
|
|
175
|
+
def read( # pyright: ignore[reportIncompatibleMethodOverride]
|
|
176
|
+
cls, file, *args, **kwargs
|
|
177
|
+
):
|
|
160
178
|
data = None
|
|
161
179
|
size = kwargs.get("size", None)
|
|
162
180
|
handle = cls._handle(file)
|
|
@@ -164,11 +182,14 @@ class FsEngine(StorageEngine):
|
|
|
164
182
|
data = handle.read(size or -1)
|
|
165
183
|
finally:
|
|
166
184
|
is_final = True if not size or not data else False
|
|
167
|
-
is_final
|
|
185
|
+
if is_final:
|
|
186
|
+
cls.cleanup(file)
|
|
168
187
|
return data
|
|
169
188
|
|
|
170
189
|
@classmethod
|
|
171
|
-
def seek(
|
|
190
|
+
def seek( # pyright: ignore[reportIncompatibleMethodOverride]
|
|
191
|
+
cls, file, *args, **kwargs
|
|
192
|
+
):
|
|
172
193
|
offset = kwargs.get("offset", None)
|
|
173
194
|
if offset == None:
|
|
174
195
|
return
|
|
@@ -176,14 +197,16 @@ class FsEngine(StorageEngine):
|
|
|
176
197
|
handle.seek(offset)
|
|
177
198
|
|
|
178
199
|
@classmethod
|
|
179
|
-
def cleanup(
|
|
200
|
+
def cleanup( # pyright: ignore[reportIncompatibleMethodOverride]
|
|
201
|
+
cls, file, *args, **kwargs
|
|
202
|
+
):
|
|
180
203
|
if not hasattr(file, "_handle"):
|
|
181
204
|
return
|
|
182
205
|
file._handle.close()
|
|
183
206
|
del file._handle
|
|
184
207
|
|
|
185
208
|
@classmethod
|
|
186
|
-
def is_seekable(
|
|
209
|
+
def is_seekable(cls): # pyright: ignore[reportIncompatibleMethodOverride]
|
|
187
210
|
return True
|
|
188
211
|
|
|
189
212
|
@classmethod
|
|
@@ -207,7 +230,7 @@ class FsEngine(StorageEngine):
|
|
|
207
230
|
@classmethod
|
|
208
231
|
def _file_path(cls, file, ensure=True, base=None):
|
|
209
232
|
# verifies that the standard params value is defined and
|
|
210
|
-
# if that's
|
|
233
|
+
# if that's not the case defaults the value, then tries to
|
|
211
234
|
# retrieve a series of parameters for file path discovery
|
|
212
235
|
params = file.params or {}
|
|
213
236
|
file_path = params.get("file_path", None)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from .typesf import File
|
|
4
|
+
|
|
5
|
+
class StorageEngine:
|
|
6
|
+
@classmethod
|
|
7
|
+
def load(cls, file: File, *args, **kwargs) -> None: ...
|
|
8
|
+
@classmethod
|
|
9
|
+
def store(cls, file: File, *args, **kwargs) -> None: ...
|
|
10
|
+
@classmethod
|
|
11
|
+
def delete(cls, file: File, *args, **kwargs) -> None: ...
|
|
12
|
+
@classmethod
|
|
13
|
+
def read(cls, file: File, *args, **kwargs) -> bytes | None: ...
|
|
14
|
+
@classmethod
|
|
15
|
+
def seek(cls, file: File, *args, **kwargs) -> None: ...
|
|
16
|
+
@classmethod
|
|
17
|
+
def cleanup(cls, file: File, *args, **kwargs) -> None: ...
|
|
18
|
+
@classmethod
|
|
19
|
+
def is_seekable(cls) -> bool: ...
|
|
20
|
+
@classmethod
|
|
21
|
+
def is_stored(cls) -> bool: ...
|
|
22
|
+
@classmethod
|
|
23
|
+
def _compute(cls, file: File, *args, **kwargs) -> None: ...
|
|
24
|
+
|
|
25
|
+
class BaseEngine(StorageEngine):
|
|
26
|
+
@classmethod
|
|
27
|
+
def load(cls, file: File, *args, **kwargs) -> None: ...
|
|
28
|
+
@classmethod
|
|
29
|
+
def store(cls, file: File, *args, **kwargs) -> None: ...
|
|
30
|
+
@classmethod
|
|
31
|
+
def delete(cls, file: File, *args, **kwargs) -> None: ...
|
|
32
|
+
@classmethod
|
|
33
|
+
def read(cls, file: File, *args, **kwargs) -> bytes | None: ...
|
|
34
|
+
@classmethod
|
|
35
|
+
def cleanup(cls, file: File, *args, **kwargs) -> None: ...
|
|
36
|
+
@classmethod
|
|
37
|
+
def is_stored(cls) -> bool: ...
|
|
38
|
+
|
|
39
|
+
class FsEngine(StorageEngine):
|
|
40
|
+
@classmethod
|
|
41
|
+
def store(cls, file: File, *args, **kwargs) -> None: ...
|
|
42
|
+
@classmethod
|
|
43
|
+
def load(cls, file: File, *args, **kwargs) -> None: ...
|
|
44
|
+
@classmethod
|
|
45
|
+
def delete(cls, file: File, *args, **kwargs) -> None: ...
|
|
46
|
+
@classmethod
|
|
47
|
+
def read(cls, file: File, *args, **kwargs) -> bytes | None: ...
|
|
48
|
+
@classmethod
|
|
49
|
+
def seek(cls, file: File, *args, **kwargs) -> None: ...
|
|
50
|
+
@classmethod
|
|
51
|
+
def cleanup(cls, file: File, *args, **kwargs) -> None: ...
|
|
52
|
+
@classmethod
|
|
53
|
+
def is_seekable(cls) -> bool: ...
|
|
54
|
+
@classmethod
|
|
55
|
+
def _compute(cls, file: File) -> None: ...
|
|
56
|
+
@classmethod
|
|
57
|
+
def _handle(cls, file: File) -> Any: ...
|
|
58
|
+
@classmethod
|
|
59
|
+
def _file_path(
|
|
60
|
+
cls, file: File, ensure: bool = ..., base: str | None = ...
|
|
61
|
+
) -> str: ...
|