dycw-utilities 0.119.0__tar.gz → 0.121.0__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 (223) hide show
  1. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/PKG-INFO +3 -3
  2. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/pyproject.toml +5 -5
  3. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_asyncio.py +33 -46
  4. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_redis.py +10 -10
  5. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_slack_sdk.py +5 -5
  6. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_sqlalchemy.py +7 -7
  7. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/__init__.py +1 -1
  8. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/asyncio.py +21 -13
  9. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/redis.py +6 -6
  10. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/slack_sdk.py +2 -2
  11. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/sqlalchemy.py +6 -6
  12. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/types.py +2 -0
  13. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/.gitignore +0 -0
  14. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/LICENSE +0 -0
  15. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/README.md +0 -0
  16. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/__init__.py +0 -0
  17. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/conftest.py +0 -0
  18. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/__init__.py +0 -0
  19. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/package_missing/__init__.py +0 -0
  20. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/package_missing/module.py +0 -0
  21. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/package_with/__init__.py +0 -0
  22. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/package_with/outer_1.py +0 -0
  23. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/package_with/outer_2.py +0 -0
  24. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/package_with/subpackage/__init__.py +0 -0
  25. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/package_with/subpackage/inner_1.py +0 -0
  26. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/package_with/subpackage/inner_2.py +0 -0
  27. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/package_with/subpackage/inner_3.py +0 -0
  28. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/package_without/__init__.py +0 -0
  29. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/package_without/module_1.py +0 -0
  30. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/package_without/module_2.py +0 -0
  31. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/standalone.py +0 -0
  32. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/modules/with_imports.py +0 -0
  33. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/regressions/test_pytest_regressions/TestMultipleRegressionFixtures__test_main__obj.json +0 -0
  34. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/regressions/test_pytest_regressions/TestMultipleRegressionFixtures__test_main__series.json +0 -0
  35. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/regressions/test_pytest_regressions/TestOrjsonRegressionFixture__test_dataclass_int.json +0 -0
  36. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/regressions/test_pytest_regressions/TestOrjsonRegressionFixture__test_dataclass_literal__false.json +0 -0
  37. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/regressions/test_pytest_regressions/TestOrjsonRegressionFixture__test_dataclass_literal__true.json +0 -0
  38. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/regressions/test_pytest_regressions/TestOrjsonRegressionFixture__test_dataclass_nested.json +0 -0
  39. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/regressions/test_pytest_regressions/TestPolarsRegressionFixture__test_dataframe.json +0 -0
  40. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/regressions/test_pytest_regressions/TestPolarsRegressionFixture__test_series.json +0 -0
  41. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_altair.py +0 -0
  42. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_astor.py +0 -0
  43. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_atomicwrites.py +0 -0
  44. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_atools.py +0 -0
  45. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_cachetools.py +0 -0
  46. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_click.py +0 -0
  47. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_concurrent.py +0 -0
  48. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_contextlib.py +0 -0
  49. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_contextvars.py +0 -0
  50. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_cryptography.py +0 -0
  51. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_cvxpy.py +0 -0
  52. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_dataclasses.py +0 -0
  53. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_datetime.py +0 -0
  54. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_enum.py +0 -0
  55. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_errors.py +0 -0
  56. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_eventkit.py +0 -0
  57. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_fastapi.py +0 -0
  58. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_fpdf2.py +0 -0
  59. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_functions.py +0 -0
  60. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_functools.py +0 -0
  61. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_getpass.py +0 -0
  62. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_git.py +0 -0
  63. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_hashlib.py +0 -0
  64. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_http.py +0 -0
  65. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_hypothesis.py +0 -0
  66. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_importlib.py +0 -0
  67. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_ipython.py +0 -0
  68. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_iterables.py +0 -0
  69. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_jupyter.py +0 -0
  70. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_lightweight_charts.py +0 -0
  71. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_logging.py +0 -0
  72. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_loguru.py +0 -0
  73. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_luigi.py +0 -0
  74. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_math.py +0 -0
  75. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_memory_profiler.py +0 -0
  76. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_modules.py +0 -0
  77. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_more_itertools.py +0 -0
  78. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_numpy.py +0 -0
  79. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_operator.py +0 -0
  80. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_optuna.py +0 -0
  81. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_orjson.py +0 -0
  82. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_os.py +0 -0
  83. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_parse.py +0 -0
  84. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_pathlib.py +0 -0
  85. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_period.py +0 -0
  86. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_pickle.py +0 -0
  87. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_platform.py +0 -0
  88. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_polars.py +0 -0
  89. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_polars_ols.py +0 -0
  90. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_pqdm.py +0 -0
  91. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_pydantic.py +0 -0
  92. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_pyinstrument.py +0 -0
  93. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_pyrsistent.py +0 -0
  94. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_pytest.py +0 -0
  95. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_pytest_regressions.py +0 -0
  96. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_python_dotenv.py +0 -0
  97. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_random.py +0 -0
  98. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_re.py +0 -0
  99. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_reprlib.py +0 -0
  100. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_rich.py +0 -0
  101. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_scipy.py +0 -0
  102. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_sentinel.py +0 -0
  103. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_shelve.py +0 -0
  104. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_socket.py +0 -0
  105. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_sqlalchemy_polars.py +0 -0
  106. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_statsmodel.py +0 -0
  107. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_streamlit.py +0 -0
  108. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_sys.py +0 -0
  109. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_tempfile.py +0 -0
  110. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_tenacity.py +0 -0
  111. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_text.py +0 -0
  112. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_threading.py +0 -0
  113. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_timer.py +0 -0
  114. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_traceback.py +0 -0
  115. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_traceback_funcs/__init__.py +0 -0
  116. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_traceback_funcs/chain.py +0 -0
  117. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_traceback_funcs/decorated_async.py +0 -0
  118. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_traceback_funcs/decorated_sync.py +0 -0
  119. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_traceback_funcs/error_bind.py +0 -0
  120. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_traceback_funcs/many.py +0 -0
  121. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_traceback_funcs/one.py +0 -0
  122. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_traceback_funcs/recursive.py +0 -0
  123. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_traceback_funcs/task_group_one.py +0 -0
  124. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_traceback_funcs/task_group_two.py +0 -0
  125. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_traceback_funcs/two.py +0 -0
  126. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_traceback_funcs/untraced.py +0 -0
  127. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_types.py +0 -0
  128. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_typing.py +0 -0
  129. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_typing_funcs/__init__.py +0 -0
  130. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_typing_funcs/no_future.py +0 -0
  131. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_typing_funcs/with_future.py +0 -0
  132. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_tzdata.py +0 -0
  133. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_tzlocal.py +0 -0
  134. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_uuid.py +0 -0
  135. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_version.py +0 -0
  136. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_warnings.py +0 -0
  137. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_whenever.py +0 -0
  138. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_zipfile.py +0 -0
  139. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/tests/test_zoneinfo.py +0 -0
  140. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/altair.py +0 -0
  141. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/astor.py +0 -0
  142. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/atomicwrites.py +0 -0
  143. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/atools.py +0 -0
  144. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/cachetools.py +0 -0
  145. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/click.py +0 -0
  146. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/concurrent.py +0 -0
  147. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/contextlib.py +0 -0
  148. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/contextvars.py +0 -0
  149. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/cryptography.py +0 -0
  150. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/cvxpy.py +0 -0
  151. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/dataclasses.py +0 -0
  152. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/datetime.py +0 -0
  153. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/enum.py +0 -0
  154. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/errors.py +0 -0
  155. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/eventkit.py +0 -0
  156. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/fastapi.py +0 -0
  157. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/fpdf2.py +0 -0
  158. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/functions.py +0 -0
  159. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/functools.py +0 -0
  160. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/getpass.py +0 -0
  161. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/git.py +0 -0
  162. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/hashlib.py +0 -0
  163. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/http.py +0 -0
  164. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/hypothesis.py +0 -0
  165. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/importlib.py +0 -0
  166. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/ipython.py +0 -0
  167. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/iterables.py +0 -0
  168. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/jupyter.py +0 -0
  169. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/lightweight_charts.py +0 -0
  170. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/logging.py +0 -0
  171. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/loguru.py +0 -0
  172. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/luigi.py +0 -0
  173. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/math.py +0 -0
  174. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/memory_profiler.py +0 -0
  175. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/modules.py +0 -0
  176. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/more_itertools.py +0 -0
  177. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/numpy.py +0 -0
  178. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/operator.py +0 -0
  179. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/optuna.py +0 -0
  180. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/orjson.py +0 -0
  181. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/os.py +0 -0
  182. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/parse.py +0 -0
  183. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/pathlib.py +0 -0
  184. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/period.py +0 -0
  185. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/pickle.py +0 -0
  186. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/platform.py +0 -0
  187. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/polars.py +0 -0
  188. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/polars_ols.py +0 -0
  189. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/pqdm.py +0 -0
  190. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/py.typed +0 -0
  191. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/pydantic.py +0 -0
  192. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/pyinstrument.py +0 -0
  193. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/pyrsistent.py +0 -0
  194. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/pytest.py +0 -0
  195. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/pytest_regressions.py +0 -0
  196. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/python_dotenv.py +0 -0
  197. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/random.py +0 -0
  198. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/re.py +0 -0
  199. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/reprlib.py +0 -0
  200. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/rich.py +0 -0
  201. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/scipy.py +0 -0
  202. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/sentinel.py +0 -0
  203. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/shelve.py +0 -0
  204. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/socket.py +0 -0
  205. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/sqlalchemy_polars.py +0 -0
  206. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/statsmodels.py +0 -0
  207. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/streamlit.py +0 -0
  208. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/sys.py +0 -0
  209. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/tempfile.py +0 -0
  210. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/tenacity.py +0 -0
  211. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/text.py +0 -0
  212. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/threading.py +0 -0
  213. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/timer.py +0 -0
  214. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/traceback.py +0 -0
  215. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/typing.py +0 -0
  216. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/tzdata.py +0 -0
  217. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/tzlocal.py +0 -0
  218. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/uuid.py +0 -0
  219. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/version.py +0 -0
  220. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/warnings.py +0 -0
  221. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/whenever.py +0 -0
  222. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/zipfile.py +0 -0
  223. {dycw_utilities-0.119.0 → dycw_utilities-0.121.0}/src/utilities/zoneinfo.py +0 -0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dycw-utilities
3
- Version: 0.119.0
3
+ Version: 0.121.0
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
7
7
  Requires-Dist: typing-extensions<4.14,>=4.13.1
8
8
  Provides-Extra: test
9
- Requires-Dist: hypothesis<6.132,>=6.131.19; extra == 'test'
9
+ Requires-Dist: hypothesis<6.132,>=6.131.20; extra == 'test'
10
10
  Requires-Dist: pytest-asyncio<0.27,>=0.26.0; extra == 'test'
11
11
  Requires-Dist: pytest-cov<6.2,>=6.1.1; extra == 'test'
12
12
  Requires-Dist: pytest-instafail<0.6,>=0.5.0; extra == 'test'
@@ -80,7 +80,7 @@ Provides-Extra: zzz-test-hypothesis
80
80
  Requires-Dist: aiosqlite<0.22,>=0.21.0; extra == 'zzz-test-hypothesis'
81
81
  Requires-Dist: asyncpg<0.31,>=0.30.0; extra == 'zzz-test-hypothesis'
82
82
  Requires-Dist: greenlet<3.3,>=3.2.0; extra == 'zzz-test-hypothesis'
83
- Requires-Dist: hypothesis<6.132,>=6.131.19; extra == 'zzz-test-hypothesis'
83
+ Requires-Dist: hypothesis<6.132,>=6.131.20; extra == 'zzz-test-hypothesis'
84
84
  Requires-Dist: luigi<3.7,>=3.6.0; extra == 'zzz-test-hypothesis'
85
85
  Requires-Dist: numpy<2.3,>=2.2.6; extra == 'zzz-test-hypothesis'
86
86
  Requires-Dist: pathvalidate<3.3,>=3.2.3; extra == 'zzz-test-hypothesis'
@@ -26,7 +26,7 @@ dev = [
26
26
  "fpdf2 >= 2.8.3, < 2.9",
27
27
  "greenlet >= 3.2.0, < 3.3", # for sqlalchemy async
28
28
  "httpx >= 0.28.1, < 0.29", # for fastapi
29
- "hypothesis >= 6.131.19, < 6.132",
29
+ "hypothesis >= 6.131.20, < 6.132",
30
30
  "img2pdf >= 0.6.0, < 0.7",
31
31
  "lightweight-charts >= 2.1, < 2.2",
32
32
  "loguru >= 0.7.3, < 0.8",
@@ -92,11 +92,11 @@ dependencies = [
92
92
  name = "dycw-utilities"
93
93
  readme = "README.md"
94
94
  requires-python = ">= 3.12"
95
- version = "0.119.0"
95
+ version = "0.121.0"
96
96
 
97
97
  [project.optional-dependencies]
98
98
  test = [
99
- "hypothesis >= 6.131.19, < 6.132",
99
+ "hypothesis >= 6.131.20, < 6.132",
100
100
  "pytest >= 8.3.5, < 8.4",
101
101
  "pytest-asyncio >= 0.26.0, < 0.27",
102
102
  "pytest-cov >= 6.1.1, < 6.2",
@@ -174,7 +174,7 @@ zzz-test-hypothesis = [
174
174
  "aiosqlite >= 0.21.0, < 0.22",
175
175
  "asyncpg >= 0.30.0, < 0.31", # for sqlalchemy async
176
176
  "greenlet >= 3.2.0, < 3.3", # for sqlalchemy async
177
- "hypothesis >= 6.131.19, < 6.132",
177
+ "hypothesis >= 6.131.20, < 6.132",
178
178
  "luigi >= 3.6.0, < 3.7",
179
179
  "numpy >= 2.2.6, < 2.3",
180
180
  "pathvalidate >= 3.2.3, < 3.3",
@@ -334,7 +334,7 @@ zzz-test-zoneinfo = [
334
334
  # bump-my-version
335
335
  [tool.bumpversion]
336
336
  allow_dirty = true
337
- current_version = "0.119.0"
337
+ current_version = "0.121.0"
338
338
 
339
339
  [[tool.bumpversion.files]]
340
340
  filename = "src/utilities/__init__.py"
@@ -5,7 +5,7 @@ from dataclasses import dataclass, field
5
5
  from functools import partial
6
6
  from itertools import chain, count
7
7
  from re import search
8
- from typing import TYPE_CHECKING, Self, override
8
+ from typing import TYPE_CHECKING, Any, Self, cast, override
9
9
 
10
10
  from hypothesis import HealthCheck, Phase, given, settings
11
11
  from hypothesis.strategies import (
@@ -23,12 +23,12 @@ from pytest import LogCaptureFixture, mark, raises
23
23
  from utilities.asyncio import (
24
24
  EnhancedTaskGroup,
25
25
  InfiniteLooper,
26
- InfiniteLooperError,
27
26
  InfiniteQueueLooper,
28
27
  InfiniteQueueLooperError,
29
28
  UniquePriorityQueue,
30
29
  UniqueQueue,
31
- _DurationOrEvery,
30
+ _InfiniteLooperDefaultEventError,
31
+ _InfiniteLooperNoSuchEventError,
32
32
  get_event,
33
33
  get_items,
34
34
  get_items_nowait,
@@ -56,7 +56,13 @@ from utilities.timer import Timer
56
56
  if TYPE_CHECKING:
57
57
  from collections.abc import Callable, Iterator
58
58
 
59
- from utilities.types import Coroutine1, Duration, MaybeCallableEvent, MaybeType
59
+ from utilities.types import (
60
+ Coroutine1,
61
+ Duration,
62
+ DurationOrEveryDuration,
63
+ MaybeCallableEvent,
64
+ MaybeType,
65
+ )
60
66
 
61
67
 
62
68
  class TestEnhancedTaskGroup:
@@ -130,7 +136,7 @@ class TestGetEvent:
130
136
 
131
137
  class TestInfiniteLooper:
132
138
  @given(n=integers(10, 11), sleep_core=sampled_from([0.1, ("every", 0.1)]))
133
- async def test_main(self, *, n: int, sleep_core: _DurationOrEvery) -> None:
139
+ async def test_main(self, *, n: int, sleep_core: DurationOrEveryDuration) -> None:
134
140
  class TrueError(BaseException): ...
135
141
 
136
142
  class FalseError(BaseException): ...
@@ -147,7 +153,7 @@ class TestInfiniteLooper:
147
153
  async def _core(self) -> None:
148
154
  self.counter += 1
149
155
  if self.counter >= n:
150
- self._set_event(n % 2 == 0)
156
+ self._set_event(event=n % 2 == 0)
151
157
 
152
158
  @override
153
159
  def _yield_events_and_exceptions(
@@ -166,15 +172,8 @@ class TestInfiniteLooper:
166
172
  _ = await looper()
167
173
 
168
174
  async def test_hashable(self) -> None:
169
- class CustomError(Exception): ...
170
-
171
175
  @dataclass(kw_only=True, unsafe_hash=True)
172
- class Example(InfiniteLooper[None]):
173
- @override
174
- def _yield_events_and_exceptions(
175
- self,
176
- ) -> Iterator[tuple[None, MaybeType[Exception]]]:
177
- yield (None, CustomError)
176
+ class Example(InfiniteLooper[None]): ...
178
177
 
179
178
  looper = Example(sleep_core=0.1)
180
179
  _ = hash(looper)
@@ -189,8 +188,6 @@ class TestInfiniteLooper:
189
188
  obj.counter += 1
190
189
  await sleep(0.05)
191
190
 
192
- class CustomError(Exception): ...
193
-
194
191
  @dataclass(kw_only=True)
195
192
  class Example(InfiniteLooper[None]):
196
193
  initializations: int = 0
@@ -205,18 +202,12 @@ class TestInfiniteLooper:
205
202
  async def _core(self) -> None:
206
203
  self.counter += 1
207
204
  if self.counter >= 5:
208
- self._set_event(None)
205
+ self._set_event()
209
206
 
210
207
  @override
211
208
  def _yield_coroutines(self) -> Iterator[Callable[[], Coroutine1[None]]]:
212
209
  yield partial(inc_external, self)
213
210
 
214
- @override
215
- def _yield_events_and_exceptions(
216
- self,
217
- ) -> Iterator[tuple[None, MaybeType[BaseException]]]:
218
- yield (None, CustomError)
219
-
220
211
  looper = Example(sleep_core=0.05, sleep_restart=0.05)
221
212
  with raises(TimeoutError):
222
213
  async with timeout_dur(duration=1.0):
@@ -251,12 +242,6 @@ class TestInfiniteLooper:
251
242
  def _yield_coroutines(self) -> Iterator[Callable[[], Coroutine1[None]]]:
252
243
  yield dummy
253
244
 
254
- @override
255
- def _yield_events_and_exceptions(
256
- self,
257
- ) -> Iterator[tuple[None, MaybeType[BaseException]]]:
258
- yield (None, CustomError)
259
-
260
245
  looper = Example(sleep_core=0.05, sleep_restart=0.05)
261
246
  with raises(TimeoutError):
262
247
  async with timeout_dur(duration=1.0):
@@ -294,12 +279,6 @@ class TestInfiniteLooper:
294
279
  def _yield_coroutines(self) -> Iterator[Callable[[], Coroutine1[None]]]:
295
280
  yield dummy
296
281
 
297
- @override
298
- def _yield_events_and_exceptions(
299
- self,
300
- ) -> Iterator[tuple[None, MaybeType[BaseException]]]:
301
- yield (None, CustomError)
302
-
303
282
  looper = Example(sleep_core=0.05, sleep_restart=0.05, logger=logger)
304
283
  with raises(CancelledError):
305
284
  async with timeout_dur(duration=1.0):
@@ -307,6 +286,17 @@ class TestInfiniteLooper:
307
286
  assert 3 <= looper.initializations <= 5
308
287
  assert 1 <= looper.counter <= 6
309
288
 
289
+ async def test_error_default_event(self) -> None:
290
+ @dataclass(kw_only=True)
291
+ class Example(InfiniteLooper[None]): ...
292
+
293
+ looper = Example()
294
+
295
+ with raises(
296
+ _InfiniteLooperDefaultEventError, match=r"'Example' default event error"
297
+ ):
298
+ raise _InfiniteLooperDefaultEventError(looper=looper)
299
+
310
300
  @given(logger=just("logger") | none())
311
301
  @mark.parametrize(
312
302
  ("sleep_restart", "desc"),
@@ -321,7 +311,7 @@ class TestInfiniteLooper:
321
311
  async def test_error_upon_initialize(
322
312
  self,
323
313
  *,
324
- sleep_restart: _DurationOrEvery,
314
+ sleep_restart: DurationOrEveryDuration,
325
315
  desc: str,
326
316
  logger: str | None,
327
317
  caplog: LogCaptureFixture,
@@ -361,7 +351,7 @@ class TestInfiniteLooper:
361
351
  async def test_error_group_upon_coroutines(
362
352
  self,
363
353
  *,
364
- sleep_restart: _DurationOrEvery,
354
+ sleep_restart: DurationOrEveryDuration,
365
355
  desc: str,
366
356
  logger: str | None,
367
357
  caplog: LogCaptureFixture,
@@ -374,12 +364,6 @@ class TestInfiniteLooper:
374
364
  async def _core(self) -> None:
375
365
  raise CustomError
376
366
 
377
- @override
378
- def _yield_events_and_exceptions(
379
- self,
380
- ) -> Iterator[tuple[None, MaybeType[BaseException]]]:
381
- yield (None, CustomError)
382
-
383
367
  looper = Example(sleep_core=0.1, sleep_restart=sleep_restart, logger=logger)
384
368
  with raises(TimeoutError):
385
369
  async with timeout_dur(duration=0.5):
@@ -402,10 +386,13 @@ class TestInfiniteLooper:
402
386
  async def _core(self) -> None:
403
387
  self.counter += 1
404
388
  if self.counter >= 10:
405
- self._set_event(None)
389
+ self._set_event(event=cast("Any", "invalid"))
406
390
 
407
- looper = Example(sleep_core=0.1)
408
- with raises(InfiniteLooperError, match="'Example' does not have an event None"):
391
+ looper = Example()
392
+ with raises(
393
+ _InfiniteLooperNoSuchEventError,
394
+ match="'Example' does not have an event 'invalid'",
395
+ ):
409
396
  _ = await looper()
410
397
 
411
398
 
@@ -29,8 +29,8 @@ from utilities.hypothesis import (
29
29
  )
30
30
  from utilities.orjson import deserialize, serialize
31
31
  from utilities.redis import (
32
- PublisherIQL,
33
- PublisherIQLError,
32
+ Publisher,
33
+ PublisherError,
34
34
  publish,
35
35
  redis_hash_map_key,
36
36
  redis_key,
@@ -118,11 +118,11 @@ class TestPublishAndSubscribe:
118
118
  _ = task.cancel()
119
119
 
120
120
 
121
- class TestPublisherIQL:
121
+ class TestPublisher:
122
122
  @given(
123
123
  data=data(),
124
124
  channel=text_ascii(min_size=1).map(
125
- lambda c: f"{get_class_name(TestPublisherIQL)}_main_{c}"
125
+ lambda c: f"{get_class_name(TestPublisher)}_main_{c}"
126
126
  ),
127
127
  obj=make_objects(),
128
128
  )
@@ -143,7 +143,7 @@ class TestPublisherIQL:
143
143
  ):
144
144
  _ = buffer.write(str(obj_i))
145
145
 
146
- publisher = PublisherIQL(
146
+ publisher = Publisher(
147
147
  redis=test.redis, serializer=serialize, sleep_core=0.1
148
148
  )
149
149
 
@@ -162,7 +162,7 @@ class TestPublisherIQL:
162
162
  @given(
163
163
  data=data(),
164
164
  channel=text_ascii(min_size=1).map(
165
- lambda c: f"{get_class_name(TestPublisherIQL)}_text_without_serialize_{c}"
165
+ lambda c: f"{get_class_name(TestPublisher)}_text_without_serialize_{c}"
166
166
  ),
167
167
  text=text_ascii(min_size=1),
168
168
  )
@@ -182,7 +182,7 @@ class TestPublisherIQL:
182
182
  async for bytes_i in subscribe(test.redis.pubsub(), channel):
183
183
  _ = buffer.write(bytes_i)
184
184
 
185
- publisher = PublisherIQL(redis=test.redis, sleep_core=0.1)
185
+ publisher = Publisher(redis=test.redis, sleep_core=0.1)
186
186
 
187
187
  async def sleep_then_put() -> None:
188
188
  await sleep_dur(duration=0.1)
@@ -200,9 +200,9 @@ class TestPublisherIQL:
200
200
  @SKIPIF_CI_AND_NOT_LINUX
201
201
  async def test_error(self, *, data: DataObject) -> None:
202
202
  async with yield_test_redis(data) as test:
203
- publisher = PublisherIQL(redis=test.redis)
204
- with raises(PublisherIQLError, match="Error running 'PublisherIQL'"):
205
- raise PublisherIQLError(publisher=publisher)
203
+ publisher = Publisher(redis=test.redis)
204
+ with raises(PublisherError, match="Error running 'Publisher'"):
205
+ raise PublisherError(publisher=publisher)
206
206
 
207
207
 
208
208
  class TestSubscribeMessages:
@@ -12,7 +12,7 @@ from utilities.asyncio import EnhancedTaskGroup, sleep_dur
12
12
  from utilities.datetime import MINUTE
13
13
  from utilities.os import get_env_var
14
14
  from utilities.pytest import throttle
15
- from utilities.slack_sdk import SlackHandlerIQL, _get_client, send_to_slack
15
+ from utilities.slack_sdk import SlackHandler, _get_client, send_to_slack
16
16
 
17
17
  if TYPE_CHECKING:
18
18
  from collections.abc import Sequence
@@ -39,7 +39,7 @@ class TestSendToSlack:
39
39
  )
40
40
 
41
41
 
42
- class TestSlackHandlerIQL:
42
+ class TestSlackHandler:
43
43
  async def test_main(self, *, tmp_path: Path) -> None:
44
44
  messages: Sequence[str] = []
45
45
 
@@ -49,7 +49,7 @@ class TestSlackHandlerIQL:
49
49
 
50
50
  logger = getLogger(str(tmp_path))
51
51
  logger.addHandler(
52
- handler := SlackHandlerIQL("url", sleep_core=0.05, sender=sender)
52
+ handler := SlackHandler("url", sleep_core=0.05, sender=sender)
53
53
  )
54
54
 
55
55
  async def sleep_then_log() -> None:
@@ -68,13 +68,13 @@ class TestSlackHandlerIQL:
68
68
  async def test_real(self, *, tmp_path: Path) -> None:
69
69
  url = get_env_var("SLACK")
70
70
  logger = getLogger(str(tmp_path))
71
- logger.addHandler(handler := SlackHandlerIQL(url, sleep_core=0.05))
71
+ logger.addHandler(handler := SlackHandler(url, sleep_core=0.05))
72
72
 
73
73
  async def sleep_then_log() -> None:
74
74
  await sleep_dur(duration=0.05)
75
75
  for i in range(10):
76
76
  logger.warning(
77
- "message %d from %s", i, TestSlackHandlerIQL.test_real.__qualname__
77
+ "message %d from %s", i, TestSlackHandler.test_real.__qualname__
78
78
  )
79
79
 
80
80
  with raises(ExceptionGroup): # noqa: PT012
@@ -43,8 +43,8 @@ from utilities.sqlalchemy import (
43
43
  InsertItemsError,
44
44
  TablenameMixin,
45
45
  TableOrORMInstOrClass,
46
- UpserterIQL,
47
- UpserterIQLError,
46
+ Upserter,
47
+ UpserterError,
48
48
  UpsertItemsError,
49
49
  _get_dialect,
50
50
  _get_dialect_max_params,
@@ -1150,7 +1150,7 @@ class TestTupleToMapping:
1150
1150
  assert result == expected
1151
1151
 
1152
1152
 
1153
- class TestUpserterIQL:
1153
+ class TestUpserter:
1154
1154
  @given(
1155
1155
  data=data(),
1156
1156
  name=_table_names(),
@@ -1168,7 +1168,7 @@ class TestUpserterIQL:
1168
1168
  Column("value", Boolean, nullable=True),
1169
1169
  )
1170
1170
  engine = await sqlalchemy_engines(data, table)
1171
- upserter = UpserterIQL(engine=engine, sleep_core=0.1)
1171
+ upserter = Upserter(engine=engine, sleep_core=0.1)
1172
1172
  pairs = [(id_, init) for id_, init, _ in triples]
1173
1173
 
1174
1174
  async def sleep_then_put() -> None:
@@ -1187,9 +1187,9 @@ class TestUpserterIQL:
1187
1187
  @given(data=data())
1188
1188
  async def test_error(self, *, data: DataObject) -> None:
1189
1189
  engine = await sqlalchemy_engines(data)
1190
- upserter = UpserterIQL(engine=engine)
1191
- with raises(UpserterIQLError, match="Error running 'UpserterIQL'"):
1192
- raise UpserterIQLError(upserter=upserter)
1190
+ upserter = Upserter(engine=engine)
1191
+ with raises(UpserterError, match="Error running 'Upserter'"):
1192
+ raise UpserterError(upserter=upserter)
1193
1193
 
1194
1194
 
1195
1195
  class TestUpsertItems:
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.119.0"
3
+ __version__ = "0.121.0"
@@ -26,7 +26,6 @@ from typing import (
26
26
  TYPE_CHECKING,
27
27
  Any,
28
28
  Generic,
29
- Literal,
30
29
  NoReturn,
31
30
  TextIO,
32
31
  TypeVar,
@@ -49,6 +48,7 @@ from utilities.reprlib import get_repr
49
48
  from utilities.sentinel import Sentinel, sentinel
50
49
  from utilities.types import (
51
50
  Coroutine1,
51
+ DurationOrEveryDuration,
52
52
  MaybeCallableEvent,
53
53
  MaybeType,
54
54
  THashable,
@@ -121,17 +121,14 @@ class EnhancedTaskGroup(TaskGroup):
121
121
  ##
122
122
 
123
123
 
124
- type _DurationOrEvery = Duration | tuple[Literal["every"], Duration]
125
-
126
-
127
124
  @dataclass(kw_only=True, unsafe_hash=True)
128
125
  class InfiniteLooper(ABC, Generic[THashable]):
129
126
  """An infinite loop which can throw exceptions by setting events."""
130
127
 
131
- sleep_core: _DurationOrEvery = SECOND
132
- sleep_restart: _DurationOrEvery = MINUTE
128
+ sleep_core: DurationOrEveryDuration = SECOND
129
+ sleep_restart: DurationOrEveryDuration = MINUTE
133
130
  logger: str | None = None
134
- _events: Mapping[THashable, Event] = field(
131
+ _events: Mapping[THashable | None, Event] = field(
135
132
  default_factory=dict, init=False, repr=False, hash=False
136
133
  )
137
134
 
@@ -229,7 +226,7 @@ class InfiniteLooper(ABC, Generic[THashable]):
229
226
  msgs.append(f"Sleeping {self._sleep_restart_desc}...")
230
227
  getLogger(name=self.logger).error("\n".join(msgs))
231
228
 
232
- def _raise_error(self, event: THashable, /) -> NoReturn:
229
+ def _raise_error(self, event: THashable | None, /) -> NoReturn:
233
230
  """Raise the error corresponding to given event."""
234
231
  mapping = dict(self._yield_events_and_exceptions())
235
232
  error = mapping.get(event, InfiniteLooperError)
@@ -241,7 +238,7 @@ class InfiniteLooper(ABC, Generic[THashable]):
241
238
  event: Event() for event, _ in self._yield_events_and_exceptions()
242
239
  }
243
240
 
244
- async def _run_sleep(self, sleep: _DurationOrEvery, /) -> None:
241
+ async def _run_sleep(self, sleep: DurationOrEveryDuration, /) -> None:
245
242
  """Sleep until the next part of the loop."""
246
243
  match sleep:
247
244
  case int() | float() | dt.timedelta() as duration:
@@ -264,12 +261,12 @@ class InfiniteLooper(ABC, Generic[THashable]):
264
261
  case _ as never:
265
262
  assert_never(never)
266
263
 
267
- def _set_event(self, event: THashable, /) -> None:
264
+ def _set_event(self, *, event: THashable | None = None) -> None:
268
265
  """Set the given event."""
269
266
  try:
270
267
  event_obj = self._events[event]
271
268
  except KeyError:
272
- raise InfiniteLooperError(looper=self, event=event) from None
269
+ raise _InfiniteLooperNoSuchEventError(looper=self, event=event) from None
273
270
  event_obj.set()
274
271
 
275
272
  def _yield_coroutines(self) -> Iterator[Callable[[], Coroutine1[None]]]:
@@ -278,14 +275,18 @@ class InfiniteLooper(ABC, Generic[THashable]):
278
275
 
279
276
  def _yield_events_and_exceptions(
280
277
  self,
281
- ) -> Iterator[tuple[THashable, MaybeType[BaseException]]]:
278
+ ) -> Iterator[tuple[THashable | None, MaybeType[BaseException]]]:
282
279
  """Yield the events & exceptions."""
283
- yield from []
280
+ yield (None, _InfiniteLooperDefaultEventError)
284
281
 
285
282
 
286
283
  @dataclass(kw_only=True, slots=True)
287
284
  class InfiniteLooperError(Exception):
288
285
  looper: InfiniteLooper[Any]
286
+
287
+
288
+ @dataclass(kw_only=True, slots=True)
289
+ class _InfiniteLooperNoSuchEventError(InfiniteLooperError):
289
290
  event: Hashable
290
291
 
291
292
  @override
@@ -293,6 +294,13 @@ class InfiniteLooperError(Exception):
293
294
  return f"{get_class_name(self.looper)!r} does not have an event {self.event!r}"
294
295
 
295
296
 
297
+ @dataclass(kw_only=True, slots=True)
298
+ class _InfiniteLooperDefaultEventError(InfiniteLooperError):
299
+ @override
300
+ def __str__(self) -> str:
301
+ return f"{get_class_name(self.looper)!r} default event error"
302
+
303
+
296
304
  ##
297
305
 
298
306
 
@@ -589,7 +589,7 @@ async def publish(
589
589
 
590
590
 
591
591
  @dataclass(kw_only=True)
592
- class PublisherIQL(InfiniteQueueLooper[None, tuple[str, EncodableT]]):
592
+ class Publisher(InfiniteQueueLooper[None, tuple[str, EncodableT]]):
593
593
  """Publish a set of messages to Redis."""
594
594
 
595
595
  redis: Redis
@@ -612,12 +612,12 @@ class PublisherIQL(InfiniteQueueLooper[None, tuple[str, EncodableT]]):
612
612
  def _yield_events_and_exceptions(
613
613
  self,
614
614
  ) -> Iterator[tuple[None, MaybeType[BaseException]]]:
615
- yield (None, PublisherIQLError) # skipif-ci-and-not-linux
615
+ yield (None, PublisherError) # skipif-ci-and-not-linux
616
616
 
617
617
 
618
618
  @dataclass(kw_only=True)
619
- class PublisherIQLError(Exception):
620
- publisher: PublisherIQL
619
+ class PublisherError(Exception):
620
+ publisher: Publisher
621
621
 
622
622
  @override
623
623
  def __str__(self) -> str:
@@ -812,8 +812,8 @@ _ = _TestRedis
812
812
 
813
813
 
814
814
  __all__ = [
815
- "PublisherIQL",
816
- "PublisherIQLError",
815
+ "Publisher",
816
+ "PublisherError",
817
817
  "RedisHashMapKey",
818
818
  "RedisKey",
819
819
  "publish",
@@ -35,7 +35,7 @@ async def _send_adapter(url: str, text: str, /) -> None:
35
35
 
36
36
 
37
37
  @dataclass(init=False, unsafe_hash=True)
38
- class SlackHandlerIQL(Handler, InfiniteQueueLooper[None, str]):
38
+ class SlackHandler(Handler, InfiniteQueueLooper[None, str]):
39
39
  """Handler for sending messages to Slack."""
40
40
 
41
41
  @override
@@ -110,4 +110,4 @@ def _get_client(url: str, /, *, timeout: Duration = _TIMEOUT) -> AsyncWebhookCli
110
110
  return AsyncWebhookClient(url, timeout=timeout_use)
111
111
 
112
112
 
113
- __all__ = ["SendToSlackError", "SlackHandlerIQL", "send_to_slack"]
113
+ __all__ = ["SendToSlackError", "SlackHandler", "send_to_slack"]
@@ -609,7 +609,7 @@ class TablenameMixin:
609
609
 
610
610
 
611
611
  @dataclass(kw_only=True)
612
- class UpserterIQL(InfiniteQueueLooper[None, _InsertItem]):
612
+ class Upserter(InfiniteQueueLooper[None, _InsertItem]):
613
613
  """Upsert a set of items to a database."""
614
614
 
615
615
  engine: AsyncEngine
@@ -641,12 +641,12 @@ class UpserterIQL(InfiniteQueueLooper[None, _InsertItem]):
641
641
  def _yield_events_and_exceptions(
642
642
  self,
643
643
  ) -> Iterator[tuple[None, MaybeType[BaseException]]]:
644
- yield (None, UpserterIQLError)
644
+ yield (None, UpserterError)
645
645
 
646
646
 
647
647
  @dataclass(kw_only=True)
648
- class UpserterIQLError(Exception):
649
- upserter: UpserterIQL
648
+ class UpserterError(Exception):
649
+ upserter: Upserter
650
650
 
651
651
  @override
652
652
  def __str__(self) -> str:
@@ -1108,8 +1108,8 @@ __all__ = [
1108
1108
  "InsertItemsError",
1109
1109
  "TablenameMixin",
1110
1110
  "UpsertItemsError",
1111
- "UpserterIQL",
1112
- "UpserterIQLError",
1111
+ "Upserter",
1112
+ "UpserterError",
1113
1113
  "check_engine",
1114
1114
  "columnwise_max",
1115
1115
  "columnwise_min",
@@ -92,6 +92,7 @@ type DateTimeLike = MaybeStr[dt.datetime]
92
92
  type DateOrDateTime = dt.date | dt.datetime
93
93
  type Duration = Number | dt.timedelta
94
94
  type DurationLike = MaybeStr[Duration]
95
+ type DurationOrEveryDuration = Duration | tuple[Literal["every"], Duration]
95
96
  type MaybeCallableDate = MaybeCallable[dt.date]
96
97
  type MaybeCallableDateTime = MaybeCallable[dt.datetime]
97
98
  type TimeLike = MaybeStr[dt.time]
@@ -270,6 +271,7 @@ __all__ = [
270
271
  "DateTimeLike",
271
272
  "Duration",
272
273
  "DurationLike",
274
+ "DurationOrEveryDuration",
273
275
  "EnumLike",
274
276
  "ExcInfo",
275
277
  "IterableHashable",