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.
Files changed (46) hide show
  1. {haiway-0.3.0/src/haiway.egg-info → haiway-0.3.1}/PKG-INFO +1 -1
  2. {haiway-0.3.0 → haiway-0.3.1}/pyproject.toml +1 -1
  3. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/helpers/__init__.py +2 -2
  4. haiway-0.3.0/src/haiway/helpers/asynchronous.py → haiway-0.3.1/src/haiway/helpers/asynchrony.py +12 -28
  5. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/types/missing.py +3 -3
  6. {haiway-0.3.0 → haiway-0.3.1/src/haiway.egg-info}/PKG-INFO +1 -1
  7. {haiway-0.3.0 → haiway-0.3.1}/src/haiway.egg-info/SOURCES.txt +2 -2
  8. {haiway-0.3.0 → haiway-0.3.1}/LICENSE +0 -0
  9. {haiway-0.3.0 → haiway-0.3.1}/README.md +0 -0
  10. {haiway-0.3.0 → haiway-0.3.1}/setup.cfg +0 -0
  11. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/__init__.py +0 -0
  12. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/context/__init__.py +0 -0
  13. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/context/access.py +0 -0
  14. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/context/disposables.py +0 -0
  15. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/context/metrics.py +0 -0
  16. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/context/state.py +0 -0
  17. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/context/tasks.py +0 -0
  18. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/context/types.py +0 -0
  19. /haiway-0.3.0/src/haiway/helpers/cached.py → /haiway-0.3.1/src/haiway/helpers/caching.py +0 -0
  20. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/helpers/retries.py +0 -0
  21. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/helpers/throttling.py +0 -0
  22. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/helpers/timeouted.py +0 -0
  23. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/py.typed +0 -0
  24. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/state/__init__.py +0 -0
  25. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/state/attributes.py +0 -0
  26. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/state/structure.py +0 -0
  27. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/state/validation.py +0 -0
  28. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/types/__init__.py +0 -0
  29. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/types/frozen.py +0 -0
  30. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/__init__.py +0 -0
  31. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/always.py +0 -0
  32. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/env.py +0 -0
  33. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/immutable.py +0 -0
  34. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/logs.py +0 -0
  35. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/mimic.py +0 -0
  36. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/noop.py +0 -0
  37. {haiway-0.3.0 → haiway-0.3.1}/src/haiway/utils/queue.py +0 -0
  38. {haiway-0.3.0 → haiway-0.3.1}/src/haiway.egg-info/dependency_links.txt +0 -0
  39. {haiway-0.3.0 → haiway-0.3.1}/src/haiway.egg-info/requires.txt +0 -0
  40. {haiway-0.3.0 → haiway-0.3.1}/src/haiway.egg-info/top_level.txt +0 -0
  41. {haiway-0.3.0 → haiway-0.3.1}/tests/test_async_queue.py +0 -0
  42. {haiway-0.3.0 → haiway-0.3.1}/tests/test_auto_retry.py +0 -0
  43. {haiway-0.3.0 → haiway-0.3.1}/tests/test_cache.py +0 -0
  44. {haiway-0.3.0 → haiway-0.3.1}/tests/test_context.py +0 -0
  45. {haiway-0.3.0 → haiway-0.3.1}/tests/test_state.py +0 -0
  46. {haiway-0.3.0 → haiway-0.3.1}/tests/test_timeout.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: haiway
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Framework for dependency injection and state management within structured concurrency model.
5
5
  Maintainer-email: Kacper Kaliński <kacper.kalinski@miquido.com>
6
6
  License: MIT License
@@ -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.0"
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.asynchronous import asynchronous
2
- from haiway.helpers.cached import cache
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
@@ -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, Literal, cast, overload
6
+ from typing import Any, cast, overload
7
7
 
8
- from haiway.types.missing import MISSING, Missing, not_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 | Literal["default"],
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 | Literal["default"] | Missing = MISSING,
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 | Literal["default"] | Missing
67
- executor used to run the function. Specifying "default" uses a default loop executor.
68
- When not provided (Missing) no executor will be used \
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
- if not_missing(executor):
83
- return _ExecutorWrapper(
84
- wrapped,
85
- loop=loop,
86
- executor=cast(Executor | None, None if executor == "default" else executor),
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 RuntimeError("Missing has no attributes")
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 RuntimeError("Missing can't be modified")
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 RuntimeError("Missing can't be modified")
62
+ raise AttributeError("Missing can't be modified")
63
63
 
64
64
 
65
65
  MISSING: Final[Missing] = Missing()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: haiway
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Framework for dependency injection and state management within structured concurrency model.
5
5
  Maintainer-email: Kacper Kaliński <kacper.kalinski@miquido.com>
6
6
  License: MIT License
@@ -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/asynchronous.py
20
- src/haiway/helpers/cached.py
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