haiway 0.3.0__tar.gz → 0.3.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.
- {haiway-0.3.0/src/haiway.egg-info → haiway-0.3.1}/PKG-INFO +1 -1
- {haiway-0.3.0 → haiway-0.3.1}/pyproject.toml +1 -1
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/helpers/__init__.py +2 -2
- haiway-0.3.0/src/haiway/helpers/asynchronous.py → haiway-0.3.1/src/haiway/helpers/asynchrony.py +12 -28
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/types/missing.py +3 -3
- {haiway-0.3.0 → haiway-0.3.1/src/haiway.egg-info}/PKG-INFO +1 -1
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway.egg-info/SOURCES.txt +2 -2
- {haiway-0.3.0 → haiway-0.3.1}/LICENSE +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/README.md +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/setup.cfg +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/__init__.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/context/__init__.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/context/access.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/context/disposables.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/context/metrics.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/context/state.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/context/tasks.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/context/types.py +0 -0
- /haiway-0.3.0/src/haiway/helpers/cached.py → /haiway-0.3.1/src/haiway/helpers/caching.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/helpers/retries.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/helpers/throttling.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/helpers/timeouted.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/py.typed +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/state/__init__.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/state/attributes.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/state/structure.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/state/validation.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/types/__init__.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/types/frozen.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/__init__.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/always.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/env.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/immutable.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/logs.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/mimic.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/noop.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/queue.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway.egg-info/dependency_links.txt +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway.egg-info/requires.txt +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/src/haiway.egg-info/top_level.txt +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/tests/test_async_queue.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/tests/test_auto_retry.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/tests/test_cache.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/tests/test_context.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/tests/test_state.py +0 -0
- {haiway-0.3.0 → haiway-0.3.1}/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.3.
|
8
|
+
version = "0.3.1"
|
9
9
|
readme = "README.md"
|
10
10
|
maintainers = [
|
11
11
|
{ name = "Kacper Kaliński", email = "kacper.kalinski@miquido.com" },
|
@@ -1,5 +1,5 @@
|
|
1
|
-
from haiway.helpers.
|
2
|
-
from haiway.helpers.
|
1
|
+
from haiway.helpers.asynchrony import asynchronous
|
2
|
+
from haiway.helpers.caching import cache
|
3
3
|
from haiway.helpers.retries import retry
|
4
4
|
from haiway.helpers.throttling import throttle
|
5
5
|
from haiway.helpers.timeouted import timeout
|
haiway-0.3.0/src/haiway/helpers/asynchronous.py → haiway-0.3.1/src/haiway/helpers/asynchrony.py
RENAMED
@@ -3,9 +3,9 @@ from collections.abc import Callable, Coroutine
|
|
3
3
|
from concurrent.futures import Executor
|
4
4
|
from contextvars import Context, copy_context
|
5
5
|
from functools import partial
|
6
|
-
from typing import Any,
|
6
|
+
from typing import Any, cast, overload
|
7
7
|
|
8
|
-
from haiway.types.missing import MISSING, Missing
|
8
|
+
from haiway.types.missing import MISSING, Missing
|
9
9
|
|
10
10
|
__all__ = [
|
11
11
|
"asynchronous",
|
@@ -25,7 +25,7 @@ def asynchronous[**Args, Result]() -> (
|
|
25
25
|
def asynchronous[**Args, Result](
|
26
26
|
*,
|
27
27
|
loop: AbstractEventLoop | None = None,
|
28
|
-
executor: Executor
|
28
|
+
executor: Executor,
|
29
29
|
) -> Callable[
|
30
30
|
[Callable[Args, Result]],
|
31
31
|
Callable[Args, Coroutine[None, None, Result]],
|
@@ -43,7 +43,7 @@ def asynchronous[**Args, Result](
|
|
43
43
|
function: Callable[Args, Result] | None = None,
|
44
44
|
/,
|
45
45
|
loop: AbstractEventLoop | None = None,
|
46
|
-
executor: Executor |
|
46
|
+
executor: Executor | Missing = MISSING,
|
47
47
|
) -> (
|
48
48
|
Callable[
|
49
49
|
[Callable[Args, Result]],
|
@@ -63,10 +63,9 @@ def asynchronous[**Args, Result](
|
|
63
63
|
loop: AbstractEventLoop | None
|
64
64
|
loop used to call the function. When None was provided the loop currently running while \
|
65
65
|
executing the function will be used. Default is None.
|
66
|
-
executor: Executor |
|
67
|
-
executor used to run the function.
|
68
|
-
|
69
|
-
(function will by just wrapped as an async function without any executor)
|
66
|
+
executor: Executor | Missing
|
67
|
+
executor used to run the function. When not provided (Missing) default loop executor\
|
68
|
+
will be used.
|
70
69
|
|
71
70
|
Returns
|
72
71
|
-------
|
@@ -79,26 +78,11 @@ def asynchronous[**Args, Result](
|
|
79
78
|
) -> Callable[Args, Coroutine[None, None, Result]]:
|
80
79
|
assert not iscoroutinefunction(wrapped), "Cannot wrap async function in executor" # nosec: B101
|
81
80
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
)
|
88
|
-
|
89
|
-
else:
|
90
|
-
|
91
|
-
async def wrapper(
|
92
|
-
*args: Args.args,
|
93
|
-
**kwargs: Args.kwargs,
|
94
|
-
) -> Result:
|
95
|
-
return wrapped(
|
96
|
-
*args,
|
97
|
-
**kwargs,
|
98
|
-
)
|
99
|
-
|
100
|
-
_mimic_async(wrapped, within=wrapper)
|
101
|
-
return wrapper
|
81
|
+
return _ExecutorWrapper(
|
82
|
+
wrapped,
|
83
|
+
loop=loop,
|
84
|
+
executor=cast(Executor | None, None if executor is MISSING else executor),
|
85
|
+
)
|
102
86
|
|
103
87
|
if function := function:
|
104
88
|
return wrap(wrapped=function)
|
@@ -46,20 +46,20 @@ class Missing(metaclass=MissingType):
|
|
46
46
|
self,
|
47
47
|
name: str,
|
48
48
|
) -> Any:
|
49
|
-
raise
|
49
|
+
raise AttributeError("Missing has no attributes")
|
50
50
|
|
51
51
|
def __setattr__(
|
52
52
|
self,
|
53
53
|
__name: str,
|
54
54
|
__value: Any,
|
55
55
|
) -> None:
|
56
|
-
raise
|
56
|
+
raise AttributeError("Missing can't be modified")
|
57
57
|
|
58
58
|
def __delattr__(
|
59
59
|
self,
|
60
60
|
__name: str,
|
61
61
|
) -> None:
|
62
|
-
raise
|
62
|
+
raise AttributeError("Missing can't be modified")
|
63
63
|
|
64
64
|
|
65
65
|
MISSING: Final[Missing] = Missing()
|
@@ -16,8 +16,8 @@ src/haiway/context/state.py
|
|
16
16
|
src/haiway/context/tasks.py
|
17
17
|
src/haiway/context/types.py
|
18
18
|
src/haiway/helpers/__init__.py
|
19
|
-
src/haiway/helpers/
|
20
|
-
src/haiway/helpers/
|
19
|
+
src/haiway/helpers/asynchrony.py
|
20
|
+
src/haiway/helpers/caching.py
|
21
21
|
src/haiway/helpers/retries.py
|
22
22
|
src/haiway/helpers/throttling.py
|
23
23
|
src/haiway/helpers/timeouted.py
|
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
|