haiway 0.13.0__tar.gz → 0.13.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 (103) hide show
  1. {haiway-0.13.0 → haiway-0.13.1}/PKG-INFO +1 -1
  2. haiway-0.13.1/junit/test-results.xml +1 -0
  3. {haiway-0.13.0 → haiway-0.13.1}/pyproject.toml +1 -1
  4. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/context/access.py +6 -6
  5. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/context/tasks.py +1 -1
  6. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/helpers/__init__.py +4 -1
  7. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/helpers/asynchrony.py +18 -16
  8. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/helpers/caching.py +12 -9
  9. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/helpers/retries.py +3 -3
  10. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/helpers/throttling.py +16 -16
  11. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/helpers/timeouted.py +7 -6
  12. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/utils/always.py +2 -2
  13. {haiway-0.13.0 → haiway-0.13.1}/uv.lock +1 -1
  14. haiway-0.13.0/junit/test-results.xml +0 -1
  15. {haiway-0.13.0 → haiway-0.13.1}/.github/workflows/ci.yml +0 -0
  16. {haiway-0.13.0 → haiway-0.13.1}/.github/workflows/publish.yml +0 -0
  17. {haiway-0.13.0 → haiway-0.13.1}/.gitignore +0 -0
  18. {haiway-0.13.0 → haiway-0.13.1}/LICENSE +0 -0
  19. {haiway-0.13.0 → haiway-0.13.1}/Makefile +0 -0
  20. {haiway-0.13.0 → haiway-0.13.1}/README.md +0 -0
  21. {haiway-0.13.0 → haiway-0.13.1}/config/pre-push +0 -0
  22. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/.dockerignore +0 -0
  23. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/Dockerfile +0 -0
  24. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/Makefile +0 -0
  25. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/README.md +0 -0
  26. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/config/.env.example +0 -0
  27. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/config/unit.json +0 -0
  28. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/docker-compose.yml +0 -0
  29. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/pyproject.toml +0 -0
  30. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/features/__int__.py +0 -0
  31. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/features/todos/__init__.py +0 -0
  32. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/features/todos/config.py +0 -0
  33. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/features/todos/state.py +0 -0
  34. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/features/todos/types.py +0 -0
  35. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/features/todos/user_tasks.py +0 -0
  36. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/integrations/__init__.py +0 -0
  37. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/integrations/postgres/__init__.py +0 -0
  38. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/integrations/postgres/client.py +0 -0
  39. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/integrations/postgres/config.py +0 -0
  40. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/integrations/postgres/state.py +0 -0
  41. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/integrations/postgres/types.py +0 -0
  42. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/migrations/__init__.py +0 -0
  43. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/migrations/__main__.py +0 -0
  44. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/migrations/postgres/__init__.py +0 -0
  45. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/migrations/postgres/execution.py +0 -0
  46. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/migrations/postgres/migration_0.py +0 -0
  47. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/migrations/postgres/types.py +0 -0
  48. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/server/__init__.py +0 -0
  49. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/server/__main__.py +0 -0
  50. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/server/application.py +0 -0
  51. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/server/config.py +0 -0
  52. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/server/middlewares/__init__.py +0 -0
  53. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/server/middlewares/context.py +0 -0
  54. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/server/routes/__init__.py +0 -0
  55. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/server/routes/technical.py +0 -0
  56. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/server/routes/todos.py +0 -0
  57. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/solutions/__init__.py +0 -0
  58. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/solutions/user_tasks/__init__.py +0 -0
  59. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/solutions/user_tasks/config.py +0 -0
  60. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/solutions/user_tasks/postgres.py +0 -0
  61. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/solutions/user_tasks/state.py +0 -0
  62. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/src/solutions/user_tasks/types.py +0 -0
  63. {haiway-0.13.0 → haiway-0.13.1}/examples/fastAPI/uv.lock +0 -0
  64. {haiway-0.13.0 → haiway-0.13.1}/guidelines/functionalities.md +0 -0
  65. {haiway-0.13.0 → haiway-0.13.1}/guidelines/packages.md +0 -0
  66. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/__init__.py +0 -0
  67. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/context/__init__.py +0 -0
  68. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/context/disposables.py +0 -0
  69. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/context/identifier.py +0 -0
  70. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/context/logging.py +0 -0
  71. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/context/metrics.py +0 -0
  72. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/context/state.py +0 -0
  73. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/context/types.py +0 -0
  74. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/helpers/metrics.py +0 -0
  75. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/helpers/tracing.py +0 -0
  76. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/py.typed +0 -0
  77. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/state/__init__.py +0 -0
  78. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/state/attributes.py +0 -0
  79. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/state/path.py +0 -0
  80. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/state/requirement.py +0 -0
  81. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/state/structure.py +0 -0
  82. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/state/validation.py +0 -0
  83. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/types/__init__.py +0 -0
  84. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/types/default.py +0 -0
  85. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/types/frozen.py +0 -0
  86. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/types/missing.py +0 -0
  87. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/utils/__init__.py +0 -0
  88. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/utils/collections.py +0 -0
  89. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/utils/env.py +0 -0
  90. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/utils/freezing.py +0 -0
  91. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/utils/logs.py +0 -0
  92. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/utils/mimic.py +0 -0
  93. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/utils/noop.py +0 -0
  94. {haiway-0.13.0 → haiway-0.13.1}/src/haiway/utils/queue.py +0 -0
  95. {haiway-0.13.0 → haiway-0.13.1}/tests/__init__.py +0 -0
  96. {haiway-0.13.0 → haiway-0.13.1}/tests/test_async_queue.py +0 -0
  97. {haiway-0.13.0 → haiway-0.13.1}/tests/test_attribute_path.py +0 -0
  98. {haiway-0.13.0 → haiway-0.13.1}/tests/test_auto_retry.py +0 -0
  99. {haiway-0.13.0 → haiway-0.13.1}/tests/test_cache.py +0 -0
  100. {haiway-0.13.0 → haiway-0.13.1}/tests/test_context.py +0 -0
  101. {haiway-0.13.0 → haiway-0.13.1}/tests/test_state.py +0 -0
  102. {haiway-0.13.0 → haiway-0.13.1}/tests/test_streaming.py +0 -0
  103. {haiway-0.13.0 → haiway-0.13.1}/tests/test_timeout.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: haiway
3
- Version: 0.13.0
3
+ Version: 0.13.1
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
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="78" time="1.098" timestamp="2025-03-25T13:23:02.644198" hostname="fv-az1307-33"><testcase classname="tests.test_async_queue" name="test_fails_when_stream_fails" time="0.002" /><testcase classname="tests.test_async_queue" name="test_cancels_when_iteration_cancels" time="0.001" /><testcase classname="tests.test_async_queue" name="test_ends_when_stream_ends" time="0.001" /><testcase classname="tests.test_async_queue" name="test_buffers_values_when_not_reading" time="0.001" /><testcase classname="tests.test_async_queue" name="test_delivers_buffer_when_streaming_fails" time="0.001" /><testcase classname="tests.test_async_queue" name="test_delivers_updates_when_sending" time="0.001" /><testcase classname="tests.test_async_queue" name="test_fails_when_sending_to_finished" time="0.001" /><testcase classname="tests.test_async_queue" name="test_ignores_when_finishing_when_finished" time="0.001" /><testcase classname="tests.test_attribute_path" name="test_id_path_points_to_self" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_attribute_path_points_to_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_nested_attribute_path_points_to_nested_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_recursive_attribute_path_points_to_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_list_item_path_points_to_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_tuple_item_path_points_to_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_mixed_tuple_item_path_points_to_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_dict_item_path_points_to_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_id_path_set_updates_self" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_attribute_path_set_updates_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_nested_attribute_path_set_updates_nested_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_recursive_attribute_set_updates_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_list_item_path_set_updates_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_tuple_item_path_set_updates_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_mixed_tuple_item_set_updates_item" time="0.001" /><testcase classname="tests.test_attribute_path" name="test_dict_item_path_set_updates_item" time="0.000" /><testcase classname="tests.test_auto_retry" name="test_returns_value_without_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_retries_with_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_logs_issue_with_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_fails_with_exceeding_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_fails_with_cancellation" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_retries_with_selected_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_fails_with_not_selected_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_returns_value_without_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_retries_with_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_fails_with_exceeding_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_fails_with_cancellation" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_fails_when_cancelled" time="0.021" /><testcase classname="tests.test_auto_retry" name="test_async_uses_delay_with_errors" time="0.102" /><testcase classname="tests.test_auto_retry" name="test_async_uses_computed_delay_with_errors" time="0.107" /><testcase classname="tests.test_auto_retry" name="test_async_logs_issue_with_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_retries_with_selected_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_fails_with_not_selected_errors" time="0.001" /><testcase classname="tests.test_cache" name="test_returns_cache_value_with_same_argument" time="0.001" /><testcase classname="tests.test_cache" name="test_returns_fresh_value_with_different_argument" time="0.000" /><testcase classname="tests.test_cache" name="test_returns_fresh_value_with_limit_exceed" time="0.000" /><testcase classname="tests.test_cache" name="test_returns_same_value_with_repeating_argument" time="0.000" /><testcase classname="tests.test_cache" name="test_fails_with_error" time="0.000" /><testcase classname="tests.test_cache" name="test_returns_fresh_value_with_expiration_time_exceed" time="0.021" /><testcase classname="tests.test_cache" name="test_async_returns_cache_value_with_same_argument" time="0.001" /><testcase classname="tests.test_cache" name="test_async_returns_fresh_value_with_different_argument" time="0.001" /><testcase classname="tests.test_cache" name="test_async_returns_fresh_value_with_limit_exceed" time="0.001" /><testcase classname="tests.test_cache" name="test_async_returns_same_value_with_repeating_argument" time="0.001" /><testcase classname="tests.test_cache" name="test_async_returns_fresh_value_with_expiration_time_exceed" time="0.021" /><testcase classname="tests.test_cache" name="test_async_cancel_waiting_does_not_cancel_task" time="0.502" /><testcase classname="tests.test_cache" name="test_async_expiration_does_not_cancel_task" time="0.021" /><testcase classname="tests.test_cache" name="test_async_fails_with_error" time="0.001" /><testcase classname="tests.test_context" name="test_state_is_available_according_to_context" time="0.001" /><testcase classname="tests.test_context" name="test_state_update_updates_local_context" time="0.001" /><testcase classname="tests.test_context" name="test_exceptions_are_propagated" time="0.001" /><testcase classname="tests.test_state" name="test_basic_initializes_with_arguments" time="0.002" /><testcase classname="tests.test_state" name="test_basic_initializes_with_defaults" time="0.001" /><testcase classname="tests.test_state" name="test_basic_equals_checks_properties" time="0.001" /><testcase classname="tests.test_state" name="test_basic_initializes_with_arguments_and_defaults" time="0.000" /><testcase classname="tests.test_state" name="test_parametrized_initializes_with_proper_parameters" time="0.000" /><testcase classname="tests.test_state" name="test_nested_initializes_with_proper_arguments" time="0.001" /><testcase classname="tests.test_state" name="test_dict_skips_missing_properties" time="0.000" /><testcase classname="tests.test_state" name="test_initialization_allows_missing_properties" time="0.001" /><testcase classname="tests.test_state" name="test_generic_subtypes_validation" time="0.002" /><testcase classname="tests.test_state" name="test_copying_leaves_same_object" time="0.001" /><testcase classname="tests.test_streaming" name="test_fails_when_generator_fails" time="0.001" /><testcase classname="tests.test_streaming" name="test_cancels_when_iteration_cancels" time="0.001" /><testcase classname="tests.test_streaming" name="test_ends_when_generator_ends" time="0.001" /><testcase classname="tests.test_streaming" name="test_delivers_updates_when_generating" time="0.001" /><testcase classname="tests.test_streaming" name="test_streaming_context_variables_access_is_preserved" time="0.002" /><testcase classname="tests.test_streaming" name="test_nested_streaming_streams_correctly" time="0.001" /><testcase classname="tests.test_timeout" name="test_returns_result_when_returning_value" time="0.001" /><testcase classname="tests.test_timeout" name="test_raises_with_error" time="0.001" /><testcase classname="tests.test_timeout" name="test_raises_with_cancel" time="0.011" /><testcase classname="tests.test_timeout" name="test_raises_with_timeout" time="0.011" /></testsuite></testsuites>
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
  [project]
6
6
  name = "haiway"
7
7
  description = "Framework for dependency injection and state management within structured concurrency model."
8
- version = "0.13.0"
8
+ version = "0.13.1"
9
9
  readme = "README.md"
10
10
  maintainers = [
11
11
  { name = "Kacper Kaliński", email = "kacper.kalinski@miquido.com" },
@@ -238,8 +238,8 @@ class ScopeContext:
238
238
  @overload
239
239
  def __call__[Result, **Arguments](
240
240
  self,
241
- function: Callable[Arguments, Coroutine[None, None, Result]],
242
- ) -> Callable[Arguments, Coroutine[None, None, Result]]: ...
241
+ function: Callable[Arguments, Coroutine[Any, Any, Result]],
242
+ ) -> Callable[Arguments, Coroutine[Any, Any, Result]]: ...
243
243
 
244
244
  @overload
245
245
  def __call__[Result, **Arguments](
@@ -249,8 +249,8 @@ class ScopeContext:
249
249
 
250
250
  def __call__[Result, **Arguments](
251
251
  self,
252
- function: Callable[Arguments, Coroutine[None, None, Result]] | Callable[Arguments, Result],
253
- ) -> Callable[Arguments, Coroutine[None, None, Result]] | Callable[Arguments, Result]:
252
+ function: Callable[Arguments, Coroutine[Any, Any, Result]] | Callable[Arguments, Result],
253
+ ) -> Callable[Arguments, Coroutine[Any, Any, Result]] | Callable[Arguments, Result]:
254
254
  if iscoroutinefunction(function):
255
255
 
256
256
  async def async_context(
@@ -372,7 +372,7 @@ class ctx:
372
372
 
373
373
  @staticmethod
374
374
  def spawn[Result, **Arguments](
375
- function: Callable[Arguments, Coroutine[None, None, Result]],
375
+ function: Callable[Arguments, Coroutine[Any, Any, Result]],
376
376
  /,
377
377
  *args: Arguments.args,
378
378
  **kwargs: Arguments.kwargs,
@@ -383,7 +383,7 @@ class ctx:
383
383
 
384
384
  Parameters
385
385
  ----------
386
- function: Callable[Arguments, Coroutine[None, None, Result]]
386
+ function: Callable[Arguments, Coroutine[Any, Any, Result]]
387
387
  function to be called within the task group
388
388
 
389
389
  *args: Arguments.args
@@ -16,7 +16,7 @@ class TaskGroupContext:
16
16
  @classmethod
17
17
  def run[Result, **Arguments](
18
18
  cls,
19
- function: Callable[Arguments, Coroutine[None, None, Result]],
19
+ function: Callable[Arguments, Coroutine[Any, Any, Result]],
20
20
  /,
21
21
  *args: Arguments.args,
22
22
  **kwargs: Arguments.kwargs,
@@ -1,5 +1,5 @@
1
1
  from haiway.helpers.asynchrony import asynchronous, wrap_async
2
- from haiway.helpers.caching import cache
2
+ from haiway.helpers.caching import CacheMakeKey, CacheRead, CacheWrite, cache
3
3
  from haiway.helpers.metrics import MetricsHolder, MetricsLogger
4
4
  from haiway.helpers.retries import retry
5
5
  from haiway.helpers.throttling import throttle
@@ -8,6 +8,9 @@ from haiway.helpers.tracing import ArgumentsTrace, ResultTrace, traced
8
8
 
9
9
  __all__ = [
10
10
  "ArgumentsTrace",
11
+ "CacheMakeKey",
12
+ "CacheRead",
13
+ "CacheWrite",
11
14
  "MetricsHolder",
12
15
  "MetricsLogger",
13
16
  "ResultTrace",
@@ -14,9 +14,9 @@ __all__ = [
14
14
 
15
15
 
16
16
  def wrap_async[**Args, Result](
17
- function: Callable[Args, Coroutine[None, None, Result]] | Callable[Args, Result],
17
+ function: Callable[Args, Coroutine[Any, Any, Result]] | Callable[Args, Result],
18
18
  /,
19
- ) -> Callable[Args, Coroutine[None, None, Result]]:
19
+ ) -> Callable[Args, Coroutine[Any, Any, Result]]:
20
20
  if iscoroutinefunction(function):
21
21
  return function
22
22
 
@@ -30,10 +30,12 @@ def wrap_async[**Args, Result](
30
30
 
31
31
 
32
32
  @overload
33
- def asynchronous[**Args, Result]() -> Callable[
34
- [Callable[Args, Result]],
35
- Callable[Args, Coroutine[None, None, Result]],
36
- ]: ...
33
+ def asynchronous[**Args, Result]() -> (
34
+ Callable[
35
+ [Callable[Args, Result]],
36
+ Callable[Args, Coroutine[Any, Any, Result]],
37
+ ]
38
+ ): ...
37
39
 
38
40
 
39
41
  @overload
@@ -43,7 +45,7 @@ def asynchronous[**Args, Result](
43
45
  executor: Executor,
44
46
  ) -> Callable[
45
47
  [Callable[Args, Result]],
46
- Callable[Args, Coroutine[None, None, Result]],
48
+ Callable[Args, Coroutine[Any, Any, Result]],
47
49
  ]: ...
48
50
 
49
51
 
@@ -51,7 +53,7 @@ def asynchronous[**Args, Result](
51
53
  def asynchronous[**Args, Result](
52
54
  function: Callable[Args, Result],
53
55
  /,
54
- ) -> Callable[Args, Coroutine[None, None, Result]]: ...
56
+ ) -> Callable[Args, Coroutine[Any, Any, Result]]: ...
55
57
 
56
58
 
57
59
  def asynchronous[**Args, Result](
@@ -62,9 +64,9 @@ def asynchronous[**Args, Result](
62
64
  ) -> (
63
65
  Callable[
64
66
  [Callable[Args, Result]],
65
- Callable[Args, Coroutine[None, None, Result]],
67
+ Callable[Args, Coroutine[Any, Any, Result]],
66
68
  ]
67
- | Callable[Args, Coroutine[None, None, Result]]
69
+ | Callable[Args, Coroutine[Any, Any, Result]]
68
70
  ):
69
71
  """\
70
72
  Wrapper for a sync function to convert it to an async function. \
@@ -90,7 +92,7 @@ def asynchronous[**Args, Result](
90
92
 
91
93
  def wrap(
92
94
  wrapped: Callable[Args, Result],
93
- ) -> Callable[Args, Coroutine[None, None, Result]]:
95
+ ) -> Callable[Args, Coroutine[Any, Any, Result]]:
94
96
  assert not iscoroutinefunction(wrapped), "Cannot wrap async function in executor" # nosec: B101
95
97
 
96
98
  return _ExecutorWrapper(
@@ -152,7 +154,7 @@ class _ExecutorWrapper[**Args, Result]:
152
154
  instance: object,
153
155
  owner: type | None = None,
154
156
  /,
155
- ) -> Callable[Args, Coroutine[None, None, Result]]:
157
+ ) -> Callable[Args, Coroutine[Any, Any, Result]]:
156
158
  if owner is None:
157
159
  return self
158
160
 
@@ -180,8 +182,8 @@ class _ExecutorWrapper[**Args, Result]:
180
182
  def _mimic_async[**Args, Result](
181
183
  function: Callable[Args, Result],
182
184
  /,
183
- within: Callable[..., Coroutine[None, None, Result]],
184
- ) -> Callable[Args, Coroutine[None, None, Result]]:
185
+ within: Callable[..., Coroutine[Any, Any, Result]],
186
+ ) -> Callable[Args, Coroutine[Any, Any, Result]]:
185
187
  try:
186
188
  annotations: Any = getattr( # noqa: B009
187
189
  function,
@@ -192,7 +194,7 @@ def _mimic_async[**Args, Result](
192
194
  "__annotations__",
193
195
  {
194
196
  **annotations,
195
- "return": Coroutine[None, None, annotations.get("return", Any)],
197
+ "return": Coroutine[Any, Any, annotations.get("return", Any)],
196
198
  },
197
199
  )
198
200
 
@@ -234,6 +236,6 @@ def _mimic_async[**Args, Result](
234
236
  )
235
237
 
236
238
  return cast(
237
- Callable[Args, Coroutine[None, None, Result]],
239
+ Callable[Args, Coroutine[Any, Any, Result]],
238
240
  within,
239
241
  )
@@ -3,12 +3,15 @@ from collections import OrderedDict
3
3
  from collections.abc import Callable, Coroutine, Hashable
4
4
  from functools import _make_key # pyright: ignore[reportPrivateUsage]
5
5
  from time import monotonic
6
- from typing import NamedTuple, Protocol, cast, overload
6
+ from typing import Any, NamedTuple, Protocol, cast, overload
7
7
 
8
8
  from haiway.context.access import ctx
9
9
  from haiway.utils.mimic import mimic_function
10
10
 
11
11
  __all__ = [
12
+ "CacheMakeKey",
13
+ "CacheRead",
14
+ "CacheWrite",
12
15
  "cache",
13
16
  ]
14
17
 
@@ -59,7 +62,7 @@ def cache[**Args, Result, Key](
59
62
  read: CacheRead[Key, Result],
60
63
  write: CacheWrite[Key, Result],
61
64
  ) -> Callable[
62
- [Callable[Args, Coroutine[None, None, Result]]], Callable[Args, Coroutine[None, None, Result]]
65
+ [Callable[Args, Coroutine[Any, Any, Result]]], Callable[Args, Coroutine[Any, Any, Result]]
63
66
  ]: ...
64
67
 
65
68
 
@@ -73,8 +76,8 @@ def cache[**Args, Result, Key]( # noqa: PLR0913
73
76
  write: CacheWrite[Key, Result] | None = None,
74
77
  ) -> (
75
78
  Callable[
76
- [Callable[Args, Coroutine[None, None, Result]]],
77
- Callable[Args, Coroutine[None, None, Result]],
79
+ [Callable[Args, Coroutine[Any, Any, Result]]],
80
+ Callable[Args, Coroutine[Any, Any, Result]],
78
81
  ]
79
82
  | Callable[[Callable[Args, Result]], Callable[Args, Result]]
80
83
  | Callable[Args, Result]
@@ -317,13 +320,13 @@ class _AsyncCache[**Args, Result]:
317
320
 
318
321
  def __init__(
319
322
  self,
320
- function: Callable[Args, Coroutine[None, None, Result]],
323
+ function: Callable[Args, Coroutine[Any, Any, Result]],
321
324
  /,
322
325
  limit: int,
323
326
  expiration: float | None,
324
327
  make_key: CacheMakeKey[Args, Hashable],
325
328
  ) -> None:
326
- self._function: Callable[Args, Coroutine[None, None, Result]] = function
329
+ self._function: Callable[Args, Coroutine[Any, Any, Result]] = function
327
330
  self._cached: OrderedDict[Hashable, _CacheEntry[Result]] = OrderedDict()
328
331
  self._limit: int = limit
329
332
  self._make_key: CacheMakeKey[Args, Hashable] = make_key
@@ -348,7 +351,7 @@ class _AsyncCache[**Args, Result]:
348
351
  instance: object | None,
349
352
  owner: type | None = None,
350
353
  /,
351
- ) -> Callable[Args, Coroutine[None, None, Result]]:
354
+ ) -> Callable[Args, Coroutine[Any, Any, Result]]:
352
355
  assert owner is None and instance is None, "cache does not work for classes" # nosec: B101
353
356
  return self
354
357
 
@@ -405,13 +408,13 @@ class _CustomCache[**Args, Result, Key]:
405
408
 
406
409
  def __init__(
407
410
  self,
408
- function: Callable[Args, Coroutine[None, None, Result]],
411
+ function: Callable[Args, Coroutine[Any, Any, Result]],
409
412
  /,
410
413
  make_key: CacheMakeKey[Args, Key],
411
414
  read: CacheRead[Key, Result],
412
415
  write: CacheWrite[Key, Result],
413
416
  ) -> None:
414
- self._function: Callable[Args, Coroutine[None, None, Result]] = function
417
+ self._function: Callable[Args, Coroutine[Any, Any, Result]] = function
415
418
  self._make_key: CacheMakeKey[Args, Key] = make_key
416
419
  self._read: CacheRead[Key, Result] = read
417
420
  self._write: CacheWrite[Key, Result] = write
@@ -1,7 +1,7 @@
1
1
  from asyncio import CancelledError, iscoroutinefunction, sleep
2
2
  from collections.abc import Callable, Coroutine
3
3
  from time import sleep as sleep_sync
4
- from typing import cast, overload
4
+ from typing import Any, cast, overload
5
5
 
6
6
  from haiway.context import ctx
7
7
  from haiway.utils import mimic_function
@@ -178,12 +178,12 @@ def _wrap_sync[**Args, Result](
178
178
 
179
179
 
180
180
  def _wrap_async[**Args, Result](
181
- function: Callable[Args, Coroutine[None, None, Result]],
181
+ function: Callable[Args, Coroutine[Any, Any, Result]],
182
182
  *,
183
183
  limit: int,
184
184
  delay: Callable[[int, Exception], float] | float | None,
185
185
  catching: set[type[Exception]] | tuple[type[Exception], ...],
186
- ) -> Callable[Args, Coroutine[None, None, Result]]:
186
+ ) -> Callable[Args, Coroutine[Any, Any, Result]]:
187
187
  assert limit > 0, "Limit has to be greater than zero" # nosec: B101
188
188
 
189
189
  @mimic_function(function)
@@ -7,7 +7,7 @@ from collections import deque
7
7
  from collections.abc import Callable, Coroutine
8
8
  from datetime import timedelta
9
9
  from time import monotonic
10
- from typing import cast, overload
10
+ from typing import Any, cast, overload
11
11
 
12
12
  from haiway.utils.mimic import mimic_function
13
13
 
@@ -18,9 +18,9 @@ __all__ = [
18
18
 
19
19
  @overload
20
20
  def throttle[**Args, Result](
21
- function: Callable[Args, Coroutine[None, None, Result]],
21
+ function: Callable[Args, Coroutine[Any, Any, Result]],
22
22
  /,
23
- ) -> Callable[Args, Coroutine[None, None, Result]]: ...
23
+ ) -> Callable[Args, Coroutine[Any, Any, Result]]: ...
24
24
 
25
25
 
26
26
  @overload
@@ -29,21 +29,21 @@ def throttle[**Args, Result](
29
29
  limit: int = 1,
30
30
  period: timedelta | float = 1,
31
31
  ) -> Callable[
32
- [Callable[Args, Coroutine[None, None, Result]]], Callable[Args, Coroutine[None, None, Result]]
32
+ [Callable[Args, Coroutine[Any, Any, Result]]], Callable[Args, Coroutine[Any, Any, Result]]
33
33
  ]: ...
34
34
 
35
35
 
36
36
  def throttle[**Args, Result](
37
- function: Callable[Args, Coroutine[None, None, Result]] | None = None,
37
+ function: Callable[Args, Coroutine[Any, Any, Result]] | None = None,
38
38
  *,
39
39
  limit: int = 1,
40
40
  period: timedelta | float = 1,
41
41
  ) -> (
42
42
  Callable[
43
- [Callable[Args, Coroutine[None, None, Result]]],
44
- Callable[Args, Coroutine[None, None, Result]],
43
+ [Callable[Args, Coroutine[Any, Any, Result]]],
44
+ Callable[Args, Coroutine[Any, Any, Result]],
45
45
  ]
46
- | Callable[Args, Coroutine[None, None, Result]]
46
+ | Callable[Args, Coroutine[Any, Any, Result]]
47
47
  ):
48
48
  """\
49
49
  Throttle for function calls with custom limit and period time. \
@@ -53,7 +53,7 @@ def throttle[**Args, Result](
53
53
 
54
54
  Parameters
55
55
  ----------
56
- function: Callable[Args, Coroutine[None, None, Result]]
56
+ function: Callable[Args, Coroutine[Any, Any, Result]]
57
57
  function to wrap in throttle
58
58
  limit: int
59
59
  limit of executions in given period, if no period was specified
@@ -63,17 +63,17 @@ def throttle[**Args, Result](
63
63
 
64
64
  Returns
65
65
  -------
66
- Callable[[Callable[Args, Coroutine[None, None, Result]]], Callable[Args, Coroutine[None, None, Result]]] \
67
- | Callable[Args, Coroutine[None, None, Result]]
66
+ Callable[[Callable[Args, Coroutine[Any, Any, Result]]], Callable[Args, Coroutine[Any, Any, Result]]] \
67
+ | Callable[Args, Coroutine[Any, Any, Result]]
68
68
  provided function wrapped in throttle
69
69
  """ # noqa: E501
70
70
 
71
71
  def _wrap(
72
- function: Callable[Args, Coroutine[None, None, Result]],
73
- ) -> Callable[Args, Coroutine[None, None, Result]]:
72
+ function: Callable[Args, Coroutine[Any, Any, Result]],
73
+ ) -> Callable[Args, Coroutine[Any, Any, Result]]:
74
74
  assert iscoroutinefunction(function) # nosec: B101
75
75
  return cast(
76
- Callable[Args, Coroutine[None, None, Result]],
76
+ Callable[Args, Coroutine[Any, Any, Result]],
77
77
  _AsyncThrottle(
78
78
  function,
79
79
  limit=limit,
@@ -107,12 +107,12 @@ class _AsyncThrottle[**Args, Result]:
107
107
 
108
108
  def __init__(
109
109
  self,
110
- function: Callable[Args, Coroutine[None, None, Result]],
110
+ function: Callable[Args, Coroutine[Any, Any, Result]],
111
111
  /,
112
112
  limit: int,
113
113
  period: timedelta | float,
114
114
  ) -> None:
115
- self._function: Callable[Args, Coroutine[None, None, Result]] = function
115
+ self._function: Callable[Args, Coroutine[Any, Any, Result]] = function
116
116
  self._entries: deque[float] = deque()
117
117
  self._lock: Lock = Lock()
118
118
  self._limit: int = limit
@@ -1,5 +1,6 @@
1
1
  from asyncio import AbstractEventLoop, Future, Task, TimerHandle, get_running_loop
2
2
  from collections.abc import Callable, Coroutine
3
+ from typing import Any
3
4
 
4
5
  from haiway.utils.mimic import mimic_function
5
6
 
@@ -12,8 +13,8 @@ def timeout[**Args, Result](
12
13
  timeout: float,
13
14
  /,
14
15
  ) -> Callable[
15
- [Callable[Args, Coroutine[None, None, Result]]],
16
- Callable[Args, Coroutine[None, None, Result]],
16
+ [Callable[Args, Coroutine[Any, Any, Result]]],
17
+ Callable[Args, Coroutine[Any, Any, Result]],
17
18
  ]:
18
19
  """\
19
20
  Timeout wrapper for a function call. \
@@ -34,8 +35,8 @@ def timeout[**Args, Result](
34
35
  """
35
36
 
36
37
  def _wrap(
37
- function: Callable[Args, Coroutine[None, None, Result]],
38
- ) -> Callable[Args, Coroutine[None, None, Result]]:
38
+ function: Callable[Args, Coroutine[Any, Any, Result]],
39
+ ) -> Callable[Args, Coroutine[Any, Any, Result]]:
39
40
  return _AsyncTimeout(
40
41
  function,
41
42
  timeout=timeout,
@@ -60,11 +61,11 @@ class _AsyncTimeout[**Args, Result]:
60
61
 
61
62
  def __init__(
62
63
  self,
63
- function: Callable[Args, Coroutine[None, None, Result]],
64
+ function: Callable[Args, Coroutine[Any, Any, Result]],
64
65
  /,
65
66
  timeout: float,
66
67
  ) -> None:
67
- self._function: Callable[Args, Coroutine[None, None, Result]] = function
68
+ self._function: Callable[Args, Coroutine[Any, Any, Result]] = function
68
69
  self._timeout: float = timeout
69
70
 
70
71
  # mimic function attributes if able
@@ -37,7 +37,7 @@ def always[Value](
37
37
  def async_always[Value](
38
38
  value: Value,
39
39
  /,
40
- ) -> Callable[..., Coroutine[None, None, Value]]:
40
+ ) -> Callable[..., Coroutine[Any, Any, Value]]:
41
41
  """
42
42
  Factory method creating async functions returning always the same value.
43
43
 
@@ -48,7 +48,7 @@ def async_always[Value](
48
48
 
49
49
  Returns
50
50
  -------
51
- Callable[..., Coroutine[None, None, Value]]
51
+ Callable[..., Coroutine[Any, Any, Value]]
52
52
  async function ignoring arguments and always returning the provided value.
53
53
  """
54
54
 
@@ -67,7 +67,7 @@ wheels = [
67
67
 
68
68
  [[package]]
69
69
  name = "haiway"
70
- version = "0.13.0"
70
+ version = "0.13.1"
71
71
  source = { editable = "." }
72
72
 
73
73
  [package.optional-dependencies]
@@ -1 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="78" time="1.085" timestamp="2025-03-25T09:46:38.856059" hostname="fv-az1982-666"><testcase classname="tests.test_async_queue" name="test_fails_when_stream_fails" time="0.001" /><testcase classname="tests.test_async_queue" name="test_cancels_when_iteration_cancels" time="0.001" /><testcase classname="tests.test_async_queue" name="test_ends_when_stream_ends" time="0.001" /><testcase classname="tests.test_async_queue" name="test_buffers_values_when_not_reading" time="0.001" /><testcase classname="tests.test_async_queue" name="test_delivers_buffer_when_streaming_fails" time="0.001" /><testcase classname="tests.test_async_queue" name="test_delivers_updates_when_sending" time="0.001" /><testcase classname="tests.test_async_queue" name="test_fails_when_sending_to_finished" time="0.001" /><testcase classname="tests.test_async_queue" name="test_ignores_when_finishing_when_finished" time="0.001" /><testcase classname="tests.test_attribute_path" name="test_id_path_points_to_self" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_attribute_path_points_to_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_nested_attribute_path_points_to_nested_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_recursive_attribute_path_points_to_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_list_item_path_points_to_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_tuple_item_path_points_to_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_mixed_tuple_item_path_points_to_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_dict_item_path_points_to_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_id_path_set_updates_self" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_attribute_path_set_updates_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_nested_attribute_path_set_updates_nested_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_recursive_attribute_set_updates_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_list_item_path_set_updates_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_tuple_item_path_set_updates_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_mixed_tuple_item_set_updates_item" time="0.001" /><testcase classname="tests.test_attribute_path" name="test_dict_item_path_set_updates_item" time="0.000" /><testcase classname="tests.test_auto_retry" name="test_returns_value_without_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_retries_with_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_logs_issue_with_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_fails_with_exceeding_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_fails_with_cancellation" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_retries_with_selected_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_fails_with_not_selected_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_returns_value_without_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_retries_with_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_fails_with_exceeding_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_fails_with_cancellation" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_fails_when_cancelled" time="0.021" /><testcase classname="tests.test_auto_retry" name="test_async_uses_delay_with_errors" time="0.102" /><testcase classname="tests.test_auto_retry" name="test_async_uses_computed_delay_with_errors" time="0.106" /><testcase classname="tests.test_auto_retry" name="test_async_logs_issue_with_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_retries_with_selected_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_fails_with_not_selected_errors" time="0.001" /><testcase classname="tests.test_cache" name="test_returns_cache_value_with_same_argument" time="0.000" /><testcase classname="tests.test_cache" name="test_returns_fresh_value_with_different_argument" time="0.000" /><testcase classname="tests.test_cache" name="test_returns_fresh_value_with_limit_exceed" time="0.000" /><testcase classname="tests.test_cache" name="test_returns_same_value_with_repeating_argument" time="0.000" /><testcase classname="tests.test_cache" name="test_fails_with_error" time="0.000" /><testcase classname="tests.test_cache" name="test_returns_fresh_value_with_expiration_time_exceed" time="0.021" /><testcase classname="tests.test_cache" name="test_async_returns_cache_value_with_same_argument" time="0.001" /><testcase classname="tests.test_cache" name="test_async_returns_fresh_value_with_different_argument" time="0.001" /><testcase classname="tests.test_cache" name="test_async_returns_fresh_value_with_limit_exceed" time="0.001" /><testcase classname="tests.test_cache" name="test_async_returns_same_value_with_repeating_argument" time="0.001" /><testcase classname="tests.test_cache" name="test_async_returns_fresh_value_with_expiration_time_exceed" time="0.021" /><testcase classname="tests.test_cache" name="test_async_cancel_waiting_does_not_cancel_task" time="0.502" /><testcase classname="tests.test_cache" name="test_async_expiration_does_not_cancel_task" time="0.021" /><testcase classname="tests.test_cache" name="test_async_fails_with_error" time="0.001" /><testcase classname="tests.test_context" name="test_state_is_available_according_to_context" time="0.001" /><testcase classname="tests.test_context" name="test_state_update_updates_local_context" time="0.001" /><testcase classname="tests.test_context" name="test_exceptions_are_propagated" time="0.001" /><testcase classname="tests.test_state" name="test_basic_initializes_with_arguments" time="0.002" /><testcase classname="tests.test_state" name="test_basic_initializes_with_defaults" time="0.001" /><testcase classname="tests.test_state" name="test_basic_equals_checks_properties" time="0.000" /><testcase classname="tests.test_state" name="test_basic_initializes_with_arguments_and_defaults" time="0.000" /><testcase classname="tests.test_state" name="test_parametrized_initializes_with_proper_parameters" time="0.000" /><testcase classname="tests.test_state" name="test_nested_initializes_with_proper_arguments" time="0.001" /><testcase classname="tests.test_state" name="test_dict_skips_missing_properties" time="0.001" /><testcase classname="tests.test_state" name="test_initialization_allows_missing_properties" time="0.001" /><testcase classname="tests.test_state" name="test_generic_subtypes_validation" time="0.002" /><testcase classname="tests.test_state" name="test_copying_leaves_same_object" time="0.001" /><testcase classname="tests.test_streaming" name="test_fails_when_generator_fails" time="0.001" /><testcase classname="tests.test_streaming" name="test_cancels_when_iteration_cancels" time="0.001" /><testcase classname="tests.test_streaming" name="test_ends_when_generator_ends" time="0.001" /><testcase classname="tests.test_streaming" name="test_delivers_updates_when_generating" time="0.001" /><testcase classname="tests.test_streaming" name="test_streaming_context_variables_access_is_preserved" time="0.002" /><testcase classname="tests.test_streaming" name="test_nested_streaming_streams_correctly" time="0.001" /><testcase classname="tests.test_timeout" name="test_returns_result_when_returning_value" time="0.001" /><testcase classname="tests.test_timeout" name="test_raises_with_error" time="0.001" /><testcase classname="tests.test_timeout" name="test_raises_with_cancel" time="0.011" /><testcase classname="tests.test_timeout" name="test_raises_with_timeout" time="0.011" /></testsuite></testsuites>
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