haiway 0.6.3__tar.gz → 0.6.4__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.
- {haiway-0.6.3/src/haiway.egg-info → haiway-0.6.4}/PKG-INFO +1 -1
- {haiway-0.6.3 → haiway-0.6.4}/pyproject.toml +1 -1
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/state/structure.py +0 -12
- {haiway-0.6.3 → haiway-0.6.4/src/haiway.egg-info}/PKG-INFO +1 -1
- {haiway-0.6.3 → haiway-0.6.4}/tests/test_attribute_path.py +56 -24
- {haiway-0.6.3 → haiway-0.6.4}/LICENSE +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/README.md +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/setup.cfg +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/__init__.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/context/__init__.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/context/access.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/context/disposables.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/context/metrics.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/context/state.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/context/tasks.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/context/types.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/helpers/__init__.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/helpers/asynchrony.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/helpers/caching.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/helpers/retries.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/helpers/throttling.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/helpers/timeouted.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/helpers/tracing.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/py.typed +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/state/__init__.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/state/attributes.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/state/path.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/state/requirement.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/state/validation.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/types/__init__.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/types/frozen.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/types/missing.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/utils/__init__.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/utils/always.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/utils/env.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/utils/immutable.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/utils/logs.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/utils/mimic.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/utils/noop.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway/utils/queue.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway.egg-info/SOURCES.txt +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway.egg-info/dependency_links.txt +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway.egg-info/requires.txt +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/src/haiway.egg-info/top_level.txt +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/tests/test_async_queue.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/tests/test_auto_retry.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/tests/test_cache.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/tests/test_context.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/tests/test_state.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/tests/test_streaming.py +0 -0
- {haiway-0.6.3 → haiway-0.6.4}/tests/test_timeout.py +0 -0
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
5
5
|
[project]
|
6
6
|
name = "haiway"
|
7
7
|
description = "Framework for dependency injection and state management within structured concurrency model."
|
8
|
-
version = "0.6.
|
8
|
+
version = "0.6.4"
|
9
9
|
readme = "README.md"
|
10
10
|
maintainers = [
|
11
11
|
{ name = "Kacper Kaliński", email = "kacper.kalinski@miquido.com" },
|
@@ -181,18 +181,6 @@ class State(metaclass=StateMeta):
|
|
181
181
|
),
|
182
182
|
)
|
183
183
|
|
184
|
-
@classmethod
|
185
|
-
def path[Attribute](
|
186
|
-
cls,
|
187
|
-
path: Attribute,
|
188
|
-
/,
|
189
|
-
) -> AttributePath[Self, Attribute]:
|
190
|
-
assert isinstance( # nosec: B101
|
191
|
-
path, AttributePath
|
192
|
-
), "Prepare parameter path by using Self._.path.to.property or explicitly"
|
193
|
-
|
194
|
-
return cast(AttributePath[Self, Attribute], path)
|
195
|
-
|
196
184
|
def updating[Value](
|
197
185
|
self,
|
198
186
|
path: AttributePath[Self, Value] | Value,
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from collections.abc import Mapping, Sequence
|
2
|
+
from typing import cast
|
2
3
|
|
3
4
|
from haiway import AttributePath, State
|
4
5
|
|
@@ -60,36 +61,49 @@ state: ExampleState = ExampleState(
|
|
60
61
|
|
61
62
|
|
62
63
|
def test_id_path_points_to_self():
|
63
|
-
path: AttributePath[ExampleState, ExampleState] =
|
64
|
+
path: AttributePath[ExampleState, ExampleState] = cast(
|
65
|
+
AttributePath[ExampleState, ExampleState],
|
66
|
+
ExampleState._,
|
67
|
+
)
|
64
68
|
assert path(state) == state
|
65
69
|
assert path.__repr__() == "ExampleState"
|
66
70
|
assert str(path) == ""
|
67
71
|
|
68
72
|
|
69
73
|
def test_attribute_path_points_to_attribute():
|
70
|
-
path: AttributePath[ExampleState, str] =
|
74
|
+
path: AttributePath[ExampleState, str] = cast(
|
75
|
+
AttributePath[ExampleState, str],
|
76
|
+
ExampleState._.answer,
|
77
|
+
)
|
71
78
|
assert path(state) == state.answer
|
72
79
|
assert path.__repr__() == "ExampleState.answer"
|
73
80
|
assert str(path) == "answer"
|
74
81
|
|
75
82
|
|
76
83
|
def test_nested_attribute_path_points_to_nested_attribute():
|
77
|
-
path: AttributePath[ExampleState, float] =
|
84
|
+
path: AttributePath[ExampleState, float] = cast(
|
85
|
+
AttributePath[ExampleState, float],
|
86
|
+
ExampleState._.nested.value,
|
87
|
+
)
|
78
88
|
assert path(state) == state.nested.value
|
79
89
|
assert path.__repr__() == "ExampleState.nested.value"
|
80
90
|
assert str(path) == "nested.value"
|
81
91
|
|
82
92
|
|
83
93
|
def test_recursive_attribute_path_points_to_attribute():
|
84
|
-
path: AttributePath[ExampleState, RecursiveState] =
|
94
|
+
path: AttributePath[ExampleState, RecursiveState] = cast(
|
95
|
+
AttributePath[ExampleState, RecursiveState],
|
96
|
+
ExampleState._.recursive,
|
97
|
+
)
|
85
98
|
assert path(state) == state.recursive
|
86
99
|
assert path.__repr__() == "ExampleState.recursive"
|
87
100
|
assert str(path) == "recursive"
|
88
101
|
|
89
102
|
|
90
103
|
def test_list_item_path_points_to_item():
|
91
|
-
path: AttributePath[ExampleState, SequenceState] =
|
92
|
-
ExampleState
|
104
|
+
path: AttributePath[ExampleState, SequenceState] = cast(
|
105
|
+
AttributePath[ExampleState, SequenceState],
|
106
|
+
ExampleState._.list_models[1],
|
93
107
|
)
|
94
108
|
assert path(state) == state.list_models[1]
|
95
109
|
assert path.__repr__() == "ExampleState.list_models[1]"
|
@@ -97,8 +111,9 @@ def test_list_item_path_points_to_item():
|
|
97
111
|
|
98
112
|
|
99
113
|
def test_tuple_item_path_points_to_item():
|
100
|
-
path: AttributePath[ExampleState, SequenceState] =
|
101
|
-
ExampleState
|
114
|
+
path: AttributePath[ExampleState, SequenceState] = cast(
|
115
|
+
AttributePath[ExampleState, SequenceState],
|
116
|
+
ExampleState._.tuple_models[1],
|
102
117
|
)
|
103
118
|
assert path(state) == state.tuple_models[1]
|
104
119
|
assert path.__repr__() == "ExampleState.tuple_models[1]"
|
@@ -106,8 +121,8 @@ def test_tuple_item_path_points_to_item():
|
|
106
121
|
|
107
122
|
|
108
123
|
def test_mixed_tuple_item_path_points_to_item():
|
109
|
-
path: AttributePath[ExampleState, DictState] =
|
110
|
-
ExampleState._.tuple_mixed_models[1]
|
124
|
+
path: AttributePath[ExampleState, DictState] = cast(
|
125
|
+
AttributePath[ExampleState, DictState], ExampleState._.tuple_mixed_models[1]
|
111
126
|
)
|
112
127
|
assert path(state) == state.tuple_mixed_models[1]
|
113
128
|
assert path.__repr__() == "ExampleState.tuple_mixed_models[1]"
|
@@ -115,8 +130,9 @@ def test_mixed_tuple_item_path_points_to_item():
|
|
115
130
|
|
116
131
|
|
117
132
|
def test_dict_item_path_points_to_item():
|
118
|
-
path: AttributePath[ExampleState, DictState] =
|
119
|
-
ExampleState
|
133
|
+
path: AttributePath[ExampleState, DictState] = cast(
|
134
|
+
AttributePath[ExampleState, DictState],
|
135
|
+
ExampleState._.dict_models["B"],
|
120
136
|
)
|
121
137
|
assert path(state) == state.dict_models["B"]
|
122
138
|
assert path.__repr__() == "ExampleState.dict_models[B]"
|
@@ -124,14 +140,20 @@ def test_dict_item_path_points_to_item():
|
|
124
140
|
|
125
141
|
|
126
142
|
def test_id_path_set_updates_self():
|
127
|
-
path: AttributePath[ExampleState, ExampleState] =
|
143
|
+
path: AttributePath[ExampleState, ExampleState] = cast(
|
144
|
+
AttributePath[ExampleState, ExampleState],
|
145
|
+
ExampleState._,
|
146
|
+
)
|
128
147
|
assert path(state, updated=state) == state
|
129
148
|
assert path.__repr__() == "ExampleState"
|
130
149
|
assert str(path) == ""
|
131
150
|
|
132
151
|
|
133
152
|
def test_attribute_path_set_updates_attribute():
|
134
|
-
path: AttributePath[ExampleState, str] =
|
153
|
+
path: AttributePath[ExampleState, str] = cast(
|
154
|
+
AttributePath[ExampleState, str],
|
155
|
+
ExampleState._.answer,
|
156
|
+
)
|
135
157
|
updated: ExampleState = path(state, updated="changed")
|
136
158
|
assert updated != state
|
137
159
|
assert updated.answer == "changed"
|
@@ -141,7 +163,10 @@ def test_attribute_path_set_updates_attribute():
|
|
141
163
|
|
142
164
|
|
143
165
|
def test_nested_attribute_path_set_updates_nested_attribute():
|
144
|
-
path: AttributePath[ExampleState, float] =
|
166
|
+
path: AttributePath[ExampleState, float] = cast(
|
167
|
+
AttributePath[ExampleState, float],
|
168
|
+
ExampleState._.nested.value,
|
169
|
+
)
|
145
170
|
updated: ExampleState = path(state, updated=11.0)
|
146
171
|
assert updated != state
|
147
172
|
assert updated.nested.value == 11
|
@@ -151,7 +176,10 @@ def test_nested_attribute_path_set_updates_nested_attribute():
|
|
151
176
|
|
152
177
|
|
153
178
|
def test_recursive_attribute_set_updates_attribute():
|
154
|
-
path: AttributePath[ExampleState, RecursiveState] =
|
179
|
+
path: AttributePath[ExampleState, RecursiveState] = cast(
|
180
|
+
AttributePath[ExampleState, RecursiveState],
|
181
|
+
ExampleState._.recursive,
|
182
|
+
)
|
155
183
|
updated: ExampleState = path(state, updated=RecursiveState(more=None))
|
156
184
|
assert updated != state
|
157
185
|
assert updated.recursive == RecursiveState(more=None)
|
@@ -163,8 +191,9 @@ def test_recursive_attribute_set_updates_attribute():
|
|
163
191
|
|
164
192
|
|
165
193
|
def test_list_item_path_set_updates_item():
|
166
|
-
path: AttributePath[ExampleState, SequenceState] =
|
167
|
-
ExampleState
|
194
|
+
path: AttributePath[ExampleState, SequenceState] = cast(
|
195
|
+
AttributePath[ExampleState, SequenceState],
|
196
|
+
ExampleState._.list_models[1],
|
168
197
|
)
|
169
198
|
updated: ExampleState = path(state, updated=SequenceState(value=11))
|
170
199
|
assert updated != state
|
@@ -177,8 +206,9 @@ def test_list_item_path_set_updates_item():
|
|
177
206
|
|
178
207
|
|
179
208
|
def test_tuple_item_path_set_updates_item():
|
180
|
-
path: AttributePath[ExampleState, SequenceState] =
|
181
|
-
ExampleState
|
209
|
+
path: AttributePath[ExampleState, SequenceState] = cast(
|
210
|
+
AttributePath[ExampleState, SequenceState],
|
211
|
+
ExampleState._.tuple_models[1],
|
182
212
|
)
|
183
213
|
updated: ExampleState = path(state, updated=SequenceState(value=11))
|
184
214
|
assert updated != state
|
@@ -191,8 +221,9 @@ def test_tuple_item_path_set_updates_item():
|
|
191
221
|
|
192
222
|
|
193
223
|
def test_mixed_tuple_item_set_updates_item():
|
194
|
-
path: AttributePath[ExampleState, DictState] =
|
195
|
-
ExampleState
|
224
|
+
path: AttributePath[ExampleState, DictState] = cast(
|
225
|
+
AttributePath[ExampleState, DictState],
|
226
|
+
ExampleState._.tuple_mixed_models[1],
|
196
227
|
)
|
197
228
|
updated: ExampleState = path(state, updated=DictState(key="updated"))
|
198
229
|
assert updated != state
|
@@ -205,8 +236,9 @@ def test_mixed_tuple_item_set_updates_item():
|
|
205
236
|
|
206
237
|
|
207
238
|
def test_dict_item_path_set_updates_item():
|
208
|
-
path: AttributePath[ExampleState, DictState] =
|
209
|
-
ExampleState
|
239
|
+
path: AttributePath[ExampleState, DictState] = cast(
|
240
|
+
AttributePath[ExampleState, DictState],
|
241
|
+
ExampleState._.dict_models["B"],
|
210
242
|
)
|
211
243
|
updated: ExampleState = path(state, updated=DictState(key="updated"))
|
212
244
|
assert updated != state
|
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
|
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
|