haiway 0.15.1__py3-none-any.whl → 0.16.0__py3-none-any.whl
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.
- haiway/__init__.py +2 -0
- haiway/context/access.py +7 -6
- haiway/utils/__init__.py +2 -1
- haiway/utils/collections.py +43 -1
- {haiway-0.15.1.dist-info → haiway-0.16.0.dist-info}/METADATA +1 -1
- {haiway-0.15.1.dist-info → haiway-0.16.0.dist-info}/RECORD +8 -8
- {haiway-0.15.1.dist-info → haiway-0.16.0.dist-info}/WHEEL +0 -0
- {haiway-0.15.1.dist-info → haiway-0.16.0.dist-info}/licenses/LICENSE +0 -0
haiway/__init__.py
CHANGED
@@ -58,6 +58,7 @@ from haiway.utils import (
|
|
58
58
|
mimic_function,
|
59
59
|
noop,
|
60
60
|
setup_logging,
|
61
|
+
without_missing,
|
61
62
|
)
|
62
63
|
|
63
64
|
__all__ = [
|
@@ -115,5 +116,6 @@ __all__ = [
|
|
115
116
|
"timeout",
|
116
117
|
"traced",
|
117
118
|
"when_missing",
|
119
|
+
"without_missing",
|
118
120
|
"wrap_async",
|
119
121
|
]
|
haiway/context/access.py
CHANGED
@@ -20,7 +20,7 @@ from haiway.context.disposables import Disposable, Disposables
|
|
20
20
|
from haiway.context.identifier import ScopeIdentifier
|
21
21
|
from haiway.context.logging import LoggerContext
|
22
22
|
from haiway.context.metrics import MetricsContext, MetricsHandler
|
23
|
-
from haiway.context.state import StateContext
|
23
|
+
from haiway.context.state import ScopeState, StateContext
|
24
24
|
from haiway.context.tasks import TaskGroupContext
|
25
25
|
from haiway.state import State
|
26
26
|
from haiway.utils import mimic_function
|
@@ -70,9 +70,7 @@ class ScopeContext:
|
|
70
70
|
object.__setattr__(
|
71
71
|
self,
|
72
72
|
"_task_group_context",
|
73
|
-
TaskGroupContext(
|
74
|
-
task_group=task_group,
|
75
|
-
)
|
73
|
+
TaskGroupContext(task_group=task_group)
|
76
74
|
if task_group is not None or self._identifier.is_root
|
77
75
|
else None,
|
78
76
|
)
|
@@ -175,8 +173,11 @@ class ScopeContext:
|
|
175
173
|
self,
|
176
174
|
"_state_context",
|
177
175
|
StateContext(
|
178
|
-
state=
|
179
|
-
|
176
|
+
state=ScopeState(
|
177
|
+
(
|
178
|
+
*await disposables.__aenter__(),
|
179
|
+
*self._state_context._state._state.values(),
|
180
|
+
)
|
180
181
|
),
|
181
182
|
),
|
182
183
|
)
|
haiway/utils/__init__.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
from haiway.utils.always import always, async_always
|
2
|
-
from haiway.utils.collections import as_dict, as_list, as_set, as_tuple
|
2
|
+
from haiway.utils.collections import as_dict, as_list, as_set, as_tuple, without_missing
|
3
3
|
from haiway.utils.env import (
|
4
4
|
getenv_base64,
|
5
5
|
getenv_bool,
|
@@ -35,4 +35,5 @@ __all__ = [
|
|
35
35
|
"mimic_function",
|
36
36
|
"noop",
|
37
37
|
"setup_logging",
|
38
|
+
"without_missing",
|
38
39
|
]
|
haiway/utils/collections.py
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
from collections.abc import Iterable, Mapping, Set
|
2
|
-
from typing import overload
|
2
|
+
from typing import Any, cast, overload
|
3
|
+
|
4
|
+
from haiway.types.missing import MISSING
|
3
5
|
|
4
6
|
__all__ = [
|
5
7
|
"as_dict",
|
6
8
|
"as_list",
|
7
9
|
"as_set",
|
8
10
|
"as_tuple",
|
11
|
+
"without_missing",
|
9
12
|
]
|
10
13
|
|
11
14
|
|
@@ -183,3 +186,42 @@ def as_dict[K, V](
|
|
183
186
|
|
184
187
|
else:
|
185
188
|
return dict(collection)
|
189
|
+
|
190
|
+
|
191
|
+
@overload
|
192
|
+
def without_missing[T: Mapping[str, Any]](
|
193
|
+
mapping: Mapping[str, Any],
|
194
|
+
/,
|
195
|
+
) -> Mapping[str, Any]: ...
|
196
|
+
|
197
|
+
|
198
|
+
@overload
|
199
|
+
def without_missing[T: Mapping[str, Any]](
|
200
|
+
mapping: Mapping[str, Any],
|
201
|
+
/,
|
202
|
+
*,
|
203
|
+
typed: type[T],
|
204
|
+
) -> T: ...
|
205
|
+
|
206
|
+
|
207
|
+
def without_missing[T: Mapping[str, Any]](
|
208
|
+
mapping: Mapping[str, Any],
|
209
|
+
/,
|
210
|
+
*,
|
211
|
+
typed: type[T] | None = None,
|
212
|
+
) -> T | Mapping[str, Any]:
|
213
|
+
"""
|
214
|
+
Strip items with missing values.
|
215
|
+
|
216
|
+
Parameters
|
217
|
+
----------
|
218
|
+
mapping : Mapping[K, V]
|
219
|
+
The input mapping to be stripped.
|
220
|
+
|
221
|
+
Returns
|
222
|
+
-------
|
223
|
+
T | dict[str, Any]
|
224
|
+
A new mapping containing all items of the input mapping,\
|
225
|
+
except items with missing values.
|
226
|
+
"""
|
227
|
+
return cast(T, {key: value for key, value in mapping.items() if value is not MISSING})
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: haiway
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.16.0
|
4
4
|
Summary: Framework for dependency injection and state management within structured concurrency model.
|
5
5
|
Project-URL: Homepage, https://miquido.com
|
6
6
|
Project-URL: Repository, https://github.com/miquido/haiway.git
|
@@ -1,7 +1,7 @@
|
|
1
|
-
haiway/__init__.py,sha256=
|
1
|
+
haiway/__init__.py,sha256=XahuBwbI7ZFBBkcbs5882Go7QrzLtEq9XylQzuR1AJY,2125
|
2
2
|
haiway/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
haiway/context/__init__.py,sha256=feqd0eJnGQwh4B8BZXpS0fQRE-DqoFCFOHipF1jOY8A,762
|
4
|
-
haiway/context/access.py,sha256=
|
4
|
+
haiway/context/access.py,sha256=yfQ65h37FF11-ZbhnjvYTTLnj9dhQx630mzpqcYt_Co,19209
|
5
5
|
haiway/context/disposables.py,sha256=vcsh8jRaJ8Q1ob7oh5LsrSPw9f5AMTcaD_p_Gb7tXAI,2588
|
6
6
|
haiway/context/identifier.py,sha256=lz-FuspOtsaEsfb7QPrEVWYfbcMJgd3A6BGG3kLbaV0,3914
|
7
7
|
haiway/context/logging.py,sha256=F3dr6MLjodg3MX5WTInxn3r3JuihG-giBzumI0GGUQw,5590
|
@@ -27,9 +27,9 @@ haiway/types/__init__.py,sha256=-j4uDN6ix3GBXLBqXC-k_QOJSDlO6zvNCxDej8vVzek,342
|
|
27
27
|
haiway/types/default.py,sha256=h38-zFkbn_UPEiw1SdDF5rkObVmD9UJpmyhOgS1gQ9U,2208
|
28
28
|
haiway/types/frozen.py,sha256=CZhFCXnWAKEhuWSfILxA8smfdpMd5Ku694ycfLh98R8,76
|
29
29
|
haiway/types/missing.py,sha256=rDnyA2wxPkTbJl0L-zbo0owp7IJ04xkCIp6xD6wh8NI,1712
|
30
|
-
haiway/utils/__init__.py,sha256=
|
30
|
+
haiway/utils/__init__.py,sha256=VFznJ-kNjuLEqcj5Q6zxzJgvs_KIL7dTZ4FGOf72OcI,907
|
31
31
|
haiway/utils/always.py,sha256=u1tssiErzm0Q3ASc3CV1rLhcMQ54MjpMlC_bRJMQhK4,1230
|
32
|
-
haiway/utils/collections.py,sha256=
|
32
|
+
haiway/utils/collections.py,sha256=d1L4rz1LH5b53x03btz-eVxMX55maon2dvQbaDYjvco,4162
|
33
33
|
haiway/utils/env.py,sha256=-hI4CgLkzdyueuECVjm-TfR3lQjE2bDsc72w7vNC4nQ,5339
|
34
34
|
haiway/utils/freezing.py,sha256=K34ZIMzbkpgkHKH-KF73plEbXExsajNRkRTYp9nJEf4,620
|
35
35
|
haiway/utils/logs.py,sha256=oDsc1ZdqKDjlTlctLbDcp9iX98Acr-1tdw-Pyg3DElo,1577
|
@@ -37,7 +37,7 @@ haiway/utils/mimic.py,sha256=BkVjTVP2TxxC8GChPGyDV6UXVwJmiRiSWeOYZNZFHxs,1828
|
|
37
37
|
haiway/utils/noop.py,sha256=qgbZlOKWY6_23Zs43OLukK2HagIQKRyR04zrFVm5rWI,344
|
38
38
|
haiway/utils/queue.py,sha256=mF0wayKg6MegfBkgxghPDVCbX2rka6sX7KCzQCGl10s,4120
|
39
39
|
haiway/utils/stream.py,sha256=Vqyi0EwcupkVyKQ7eple6z9DkcbSHkE-6yMw85mak9Q,2832
|
40
|
-
haiway-0.
|
41
|
-
haiway-0.
|
42
|
-
haiway-0.
|
43
|
-
haiway-0.
|
40
|
+
haiway-0.16.0.dist-info/METADATA,sha256=n68Bb5H8FH_CE1uOvZ4u-eYfiuCCrHBOIFXRnPtmmtw,4299
|
41
|
+
haiway-0.16.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
42
|
+
haiway-0.16.0.dist-info/licenses/LICENSE,sha256=3phcpHVNBP8jsi77gOO0E7rgKeDeu99Pi7DSnK9YHoQ,1069
|
43
|
+
haiway-0.16.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|