dycw-utilities 0.156.0__tar.gz → 0.157.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.
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/PKG-INFO +1 -1
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/pyproject.toml +2 -2
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_asyncio.py +2 -68
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_logging.py +5 -5
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_os.py +6 -0
- dycw_utilities-0.157.1/src/tests/test_pottery.py +103 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_pytest.py +1 -6
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/__init__.py +1 -1
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/asyncio.py +1 -45
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/os.py +10 -1
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/pottery.py +6 -90
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/pytest.py +0 -9
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/redis.py +1 -2
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/sqlalchemy.py +1 -2
- dycw_utilities-0.156.0/src/tests/test_pottery.py +0 -200
- dycw_utilities-0.156.0/src/tests/test_yield_access/script.py +0 -61
- dycw_utilities-0.156.0/src/tests/test_yield_access/script.sh +0 -54
- dycw_utilities-0.156.0/src/utilities/pytest_plugins/__init__.py +0 -1
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/.gitignore +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/LICENSE +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/README.md +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/__init__.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/conftest.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/__init__.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/package_missing/__init__.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/package_missing/module.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/package_with/__init__.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/package_with/outer_1.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/package_with/outer_2.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/package_with/subpackage/__init__.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/package_with/subpackage/inner_1.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/package_with/subpackage/inner_2.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/package_with/subpackage/inner_3.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/package_without/__init__.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/package_without/module_1.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/package_without/module_2.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/standalone.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/modules/with_imports.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/regressions/test_pytest_regressions/TestMultipleRegressionFixtures__test_main__obj.json +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/regressions/test_pytest_regressions/TestMultipleRegressionFixtures__test_main__series.json +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/regressions/test_pytest_regressions/TestOrjsonRegressionFixture__test_dataclass_int.json +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/regressions/test_pytest_regressions/TestOrjsonRegressionFixture__test_dataclass_literal__false.json +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/regressions/test_pytest_regressions/TestOrjsonRegressionFixture__test_dataclass_literal__true.json +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/regressions/test_pytest_regressions/TestOrjsonRegressionFixture__test_dataclass_nested.json +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/regressions/test_pytest_regressions/TestPolarsRegressionFixture__test_dataframe.json +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/regressions/test_pytest_regressions/TestPolarsRegressionFixture__test_series.json +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_altair.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_atomicwrites.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_atools.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_cachetools.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_click.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_concurrent.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_contextlib.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_contextvars.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_cryptography.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_cvxpy.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_dataclasses.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_enum.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_errors.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_eventkit.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_fastapi.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_fpdf2.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_functions.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_functools.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_getpass.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_gzip.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_hashlib.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_http.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_hypothesis.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_importlib.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_inflect.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_ipython.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_iterables.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_json.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_jupyter.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_libcst.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_lightweight_charts.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_math.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_memory_profiler.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_modules.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_more_itertools.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_numpy.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_objects/__init__.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_objects/objects.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_operator.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_optuna.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_orjson.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_parse.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_pathlib.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_pickle.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_platform.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_polars.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_polars_ols.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_postgres.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_pqdm.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_psutil.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_pyinstrument.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_pytest_randomly.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_pytest_regressions.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_random.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_re.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_redis.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_reprlib.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_scipy.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_sentinel.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_shelve.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_slack_sdk.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_socket.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_sqlalchemy.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_sqlalchemy_polars.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_statsmodels.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_string.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_tempfile.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_text.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_threading.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_timer.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_traceback.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_typed_settings.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_types.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_typing.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_typing_funcs/__init__.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_typing_funcs/no_future.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_typing_funcs/with_future.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_tzdata.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_tzlocal.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_uuid.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_version.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_warnings.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_whenever.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_zipfile.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/tests/test_zoneinfo.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/altair.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/atomicwrites.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/atools.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/cachetools.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/click.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/concurrent.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/contextlib.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/contextvars.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/cryptography.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/cvxpy.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/dataclasses.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/enum.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/errors.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/eventkit.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/fastapi.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/fpdf2.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/functions.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/functools.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/getpass.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/gzip.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/hashlib.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/http.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/hypothesis.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/importlib.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/inflect.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/ipython.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/iterables.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/json.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/jupyter.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/libcst.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/lightweight_charts.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/logging.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/math.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/memory_profiler.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/modules.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/more_itertools.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/numpy.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/operator.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/optuna.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/orjson.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/parse.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/pathlib.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/pickle.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/platform.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/polars.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/polars_ols.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/postgres.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/pqdm.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/psutil.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/py.typed +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/pyinstrument.py +0 -0
- {dycw_utilities-0.156.0/src/tests/test_yield_access → dycw_utilities-0.157.1/src/utilities/pytest_plugins}/__init__.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/pytest_plugins/pytest_randomly.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/pytest_plugins/pytest_regressions.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/pytest_regressions.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/random.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/re.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/reprlib.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/scipy.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/sentinel.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/shelve.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/slack_sdk.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/socket.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/sqlalchemy_polars.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/statsmodels.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/string.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/tempfile.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/text.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/threading.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/timer.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/traceback.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/typed_settings.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/types.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/typing.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/tzdata.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/tzlocal.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/uuid.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/version.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/warnings.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/whenever.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/zipfile.py +0 -0
- {dycw_utilities-0.156.0 → dycw_utilities-0.157.1}/src/utilities/zoneinfo.py +0 -0
@@ -227,7 +227,7 @@ dependencies = [
|
|
227
227
|
name = "dycw-utilities"
|
228
228
|
readme = "README.md"
|
229
229
|
requires-python = ">= 3.12"
|
230
|
-
version = "0.
|
230
|
+
version = "0.157.1"
|
231
231
|
|
232
232
|
[project.entry-points.pytest11]
|
233
233
|
pytest-randomly = "utilities.pytest_plugins.pytest_randomly"
|
@@ -259,7 +259,7 @@ test = [
|
|
259
259
|
# bump-my-version
|
260
260
|
[tool.bumpversion]
|
261
261
|
allow_dirty = true
|
262
|
-
current_version = "0.
|
262
|
+
current_version = "0.157.1"
|
263
263
|
|
264
264
|
[[tool.bumpversion.files]]
|
265
265
|
filename = "src/utilities/__init__.py"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
-
from asyncio import Queue,
|
3
|
+
from asyncio import Queue, run
|
4
4
|
from collections.abc import ItemsView, KeysView, ValuesView
|
5
5
|
from contextlib import asynccontextmanager
|
6
6
|
from re import search
|
@@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, ClassVar
|
|
8
8
|
|
9
9
|
from hypothesis import HealthCheck, given, settings
|
10
10
|
from hypothesis.strategies import booleans, dictionaries, integers, lists, none
|
11
|
-
from pytest import
|
11
|
+
from pytest import RaisesGroup, raises
|
12
12
|
|
13
13
|
from utilities.asyncio import (
|
14
14
|
AsyncDict,
|
@@ -16,7 +16,6 @@ from utilities.asyncio import (
|
|
16
16
|
get_coroutine_name,
|
17
17
|
get_items,
|
18
18
|
get_items_nowait,
|
19
|
-
loop_until_succeed,
|
20
19
|
put_items,
|
21
20
|
put_items_nowait,
|
22
21
|
sleep_max,
|
@@ -29,7 +28,6 @@ from utilities.asyncio import (
|
|
29
28
|
)
|
30
29
|
from utilities.hypothesis import pairs, text_ascii
|
31
30
|
from utilities.pytest import skipif_windows
|
32
|
-
from utilities.text import unique_str
|
33
31
|
from utilities.timer import Timer
|
34
32
|
from utilities.whenever import MILLISECOND, SECOND, get_now
|
35
33
|
|
@@ -319,70 +317,6 @@ class TestGetItems:
|
|
319
317
|
assert result == xs[:max_size]
|
320
318
|
|
321
319
|
|
322
|
-
class TestLoopUntilSucceed:
|
323
|
-
@mark.parametrize("sleep", [param(MILLISECOND), param(None)])
|
324
|
-
@mark.parametrize("use_logger", [param(True), param(False)])
|
325
|
-
async def test_main(
|
326
|
-
self, *, caplog: LogCaptureFixture, sleep: TimeDelta | None, use_logger: bool
|
327
|
-
) -> None:
|
328
|
-
class CustomError(Exception): ...
|
329
|
-
|
330
|
-
caplog.set_level("DEBUG", logger=(name := unique_str()))
|
331
|
-
counter = 0
|
332
|
-
|
333
|
-
async def func() -> None:
|
334
|
-
nonlocal counter
|
335
|
-
counter += 1
|
336
|
-
if counter <= 3:
|
337
|
-
raise CustomError
|
338
|
-
|
339
|
-
assert await loop_until_succeed(
|
340
|
-
lambda: func(), logger=name if use_logger else None, sleep=sleep
|
341
|
-
)
|
342
|
-
assert counter == 4
|
343
|
-
|
344
|
-
if use_logger:
|
345
|
-
messages = [r.message for r in caplog.records if r.name == name]
|
346
|
-
expected = 3 * (
|
347
|
-
["Error running 'func'"]
|
348
|
-
+ ([] if sleep is None else ["Sleeping for PT0.001S..."])
|
349
|
-
+ ["Retrying 'func'..."]
|
350
|
-
)
|
351
|
-
assert messages == expected
|
352
|
-
|
353
|
-
async def test_error_flat(self) -> None:
|
354
|
-
class CustomError(Exception): ...
|
355
|
-
|
356
|
-
counter = 0
|
357
|
-
|
358
|
-
async def func() -> None:
|
359
|
-
nonlocal counter
|
360
|
-
counter += 1
|
361
|
-
if counter <= 3:
|
362
|
-
raise CustomError
|
363
|
-
|
364
|
-
assert not await loop_until_succeed(lambda: func(), errors=CustomError)
|
365
|
-
assert counter == 1
|
366
|
-
|
367
|
-
async def test_error_nested(self) -> None:
|
368
|
-
class CustomError(Exception): ...
|
369
|
-
|
370
|
-
counter = 0
|
371
|
-
|
372
|
-
async def func() -> None:
|
373
|
-
async with TaskGroup() as tg:
|
374
|
-
_ = tg.create_task(inner())
|
375
|
-
|
376
|
-
async def inner() -> None:
|
377
|
-
nonlocal counter
|
378
|
-
counter += 1
|
379
|
-
if counter <= 3:
|
380
|
-
raise CustomError
|
381
|
-
|
382
|
-
assert not await loop_until_succeed(lambda: func(), errors=CustomError)
|
383
|
-
assert counter == 1
|
384
|
-
|
385
|
-
|
386
320
|
class TestPutItems:
|
387
321
|
@given(xs=lists(integers(), min_size=1), wait=booleans())
|
388
322
|
async def test_main(self, *, xs: list[int], wait: bool) -> None:
|
@@ -12,7 +12,7 @@ from hypothesis.strategies import booleans, integers
|
|
12
12
|
from pytest import LogCaptureFixture, mark, param, raises
|
13
13
|
|
14
14
|
from tests.conftest import SKIPIF_CI_AND_WINDOWS
|
15
|
-
from utilities.hypothesis import pairs, temp_paths,
|
15
|
+
from utilities.hypothesis import pairs, temp_paths, zoned_date_times
|
16
16
|
from utilities.iterables import one
|
17
17
|
from utilities.logging import (
|
18
18
|
GetLoggingLevelNumberError,
|
@@ -527,12 +527,12 @@ class TestToLogger:
|
|
527
527
|
def test_default(self) -> None:
|
528
528
|
assert to_logger().name == "root"
|
529
529
|
|
530
|
-
|
531
|
-
|
530
|
+
def test_logger(self) -> None:
|
531
|
+
name = unique_str()
|
532
532
|
assert to_logger(getLogger(name)).name == name
|
533
533
|
|
534
|
-
|
535
|
-
|
534
|
+
def test_str(self) -> None:
|
535
|
+
name = unique_str()
|
536
536
|
assert to_logger(name).name == name
|
537
537
|
|
538
538
|
def test_none(self) -> None:
|
@@ -22,6 +22,7 @@ from utilities.os import (
|
|
22
22
|
get_cpu_use,
|
23
23
|
get_env_var,
|
24
24
|
is_debug,
|
25
|
+
is_pytest,
|
25
26
|
temp_environ,
|
26
27
|
)
|
27
28
|
from utilities.pytest import skipif_windows
|
@@ -124,6 +125,11 @@ class TestIsDebug:
|
|
124
125
|
assert isinstance(result, bool)
|
125
126
|
|
126
127
|
|
128
|
+
class TestIsPytest:
|
129
|
+
def test_main(self) -> None:
|
130
|
+
assert is_pytest()
|
131
|
+
|
132
|
+
|
127
133
|
class TestTempEnviron:
|
128
134
|
@given(key=text.map(_prefix), value=text)
|
129
135
|
def test_set(self, *, key: str, value: str) -> None:
|
@@ -0,0 +1,103 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from asyncio import TaskGroup
|
4
|
+
from typing import TYPE_CHECKING, ClassVar
|
5
|
+
|
6
|
+
from pottery import AIORedlock
|
7
|
+
from pytest import mark, param, raises
|
8
|
+
|
9
|
+
from utilities.asyncio import sleep_td
|
10
|
+
from utilities.pottery import (
|
11
|
+
_YieldAccessNumLocksError,
|
12
|
+
_YieldAccessUnableToAcquireLockError,
|
13
|
+
extend_lock,
|
14
|
+
yield_access,
|
15
|
+
)
|
16
|
+
from utilities.text import unique_str
|
17
|
+
from utilities.timer import Timer
|
18
|
+
from utilities.whenever import SECOND
|
19
|
+
|
20
|
+
if TYPE_CHECKING:
|
21
|
+
from redis.asyncio import Redis
|
22
|
+
from whenever import TimeDelta
|
23
|
+
|
24
|
+
|
25
|
+
class TestExtendLock:
|
26
|
+
async def test_main(self, *, test_redis: Redis) -> None:
|
27
|
+
lock = AIORedlock(key=unique_str(), masters={test_redis})
|
28
|
+
async with lock:
|
29
|
+
await extend_lock(lock=lock)
|
30
|
+
|
31
|
+
async def test_none(self) -> None:
|
32
|
+
await extend_lock()
|
33
|
+
|
34
|
+
|
35
|
+
class TestYieldAccess:
|
36
|
+
delta: ClassVar[TimeDelta] = 0.1 * SECOND
|
37
|
+
|
38
|
+
@mark.parametrize(
|
39
|
+
("num_tasks", "num_locks", "min_multiple"),
|
40
|
+
[
|
41
|
+
param(1, 1, 1),
|
42
|
+
param(1, 2, 1),
|
43
|
+
param(1, 3, 1),
|
44
|
+
param(2, 1, 2),
|
45
|
+
param(2, 2, 1),
|
46
|
+
param(2, 3, 1),
|
47
|
+
param(2, 4, 1),
|
48
|
+
param(2, 5, 1),
|
49
|
+
param(3, 1, 3),
|
50
|
+
param(3, 2, 2),
|
51
|
+
param(3, 3, 1),
|
52
|
+
param(3, 4, 1),
|
53
|
+
param(3, 5, 1),
|
54
|
+
param(4, 1, 4),
|
55
|
+
param(4, 2, 2),
|
56
|
+
param(4, 3, 2),
|
57
|
+
param(4, 4, 1),
|
58
|
+
param(4, 5, 1),
|
59
|
+
],
|
60
|
+
)
|
61
|
+
async def test_main(
|
62
|
+
self, *, test_redis: Redis, num_tasks: int, num_locks: int, min_multiple: int
|
63
|
+
) -> None:
|
64
|
+
with Timer() as timer:
|
65
|
+
await self.func(test_redis, num_tasks, unique_str(), num_locks=num_locks)
|
66
|
+
assert (min_multiple * self.delta) <= timer <= (5 * min_multiple * self.delta)
|
67
|
+
|
68
|
+
async def test_error_num_locks(self, *, test_redis: Redis) -> None:
|
69
|
+
with raises(
|
70
|
+
_YieldAccessNumLocksError,
|
71
|
+
match=r"Number of locks for '\w+' must be positive; got 0",
|
72
|
+
):
|
73
|
+
async with yield_access(test_redis, unique_str(), num=0):
|
74
|
+
...
|
75
|
+
|
76
|
+
async def test_error_unable_to_acquire_lock(self, *, test_redis: Redis) -> None:
|
77
|
+
key = unique_str()
|
78
|
+
delta = 0.1 * SECOND
|
79
|
+
|
80
|
+
async def coroutine(key: str, /) -> None:
|
81
|
+
async with yield_access(
|
82
|
+
test_redis, key, num=1, timeout_acquire=delta, throttle=5 * delta
|
83
|
+
):
|
84
|
+
await sleep_td(delta)
|
85
|
+
|
86
|
+
with raises(ExceptionGroup) as exc_info:
|
87
|
+
async with TaskGroup() as tg:
|
88
|
+
_ = tg.create_task(coroutine(key))
|
89
|
+
_ = tg.create_task(coroutine(key))
|
90
|
+
assert exc_info.group_contains(
|
91
|
+
_YieldAccessUnableToAcquireLockError,
|
92
|
+
match=r"Unable to acquire any 1 of 1 locks for '\w+' after .*",
|
93
|
+
)
|
94
|
+
|
95
|
+
async def func(
|
96
|
+
self, redis: Redis, num_tasks: int, key: str, /, *, num_locks: int = 1
|
97
|
+
) -> None:
|
98
|
+
async def coroutine() -> None:
|
99
|
+
async with yield_access(redis, key, num=num_locks):
|
100
|
+
await sleep_td(self.delta)
|
101
|
+
|
102
|
+
async with TaskGroup() as tg:
|
103
|
+
_ = [tg.create_task(coroutine()) for _ in range(num_tasks)]
|
@@ -9,7 +9,7 @@ from pytest import fixture, mark, param, raises
|
|
9
9
|
|
10
10
|
from utilities.iterables import one
|
11
11
|
from utilities.os import temp_environ
|
12
|
-
from utilities.pytest import NodeIdToPathError,
|
12
|
+
from utilities.pytest import NodeIdToPathError, node_id_path, throttle
|
13
13
|
|
14
14
|
if TYPE_CHECKING:
|
15
15
|
from collections.abc import Sequence
|
@@ -25,11 +25,6 @@ def set_asyncio_default_fixture_loop_scope(*, testdir: Testdir) -> None:
|
|
25
25
|
""")
|
26
26
|
|
27
27
|
|
28
|
-
class TestIsPytest:
|
29
|
-
def test_main(self) -> None:
|
30
|
-
assert is_pytest()
|
31
|
-
|
32
|
-
|
33
28
|
class TestNodeIdPath:
|
34
29
|
@mark.parametrize(
|
35
30
|
("node_id", "expected"),
|
@@ -1,7 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
import asyncio
|
4
|
-
import sys
|
5
4
|
from asyncio import (
|
6
5
|
Lock,
|
7
6
|
Queue,
|
@@ -36,9 +35,8 @@ from typing import (
|
|
36
35
|
override,
|
37
36
|
)
|
38
37
|
|
39
|
-
from utilities.errors import ImpossibleCaseError, is_instance_error
|
40
38
|
from utilities.functions import ensure_int, ensure_not_none
|
41
|
-
from utilities.
|
39
|
+
from utilities.os import is_pytest
|
42
40
|
from utilities.random import SYSTEM_RANDOM
|
43
41
|
from utilities.sentinel import Sentinel, sentinel
|
44
42
|
from utilities.shelve import yield_shelf
|
@@ -70,8 +68,6 @@ if TYPE_CHECKING:
|
|
70
68
|
from utilities.types import (
|
71
69
|
Coro,
|
72
70
|
Delta,
|
73
|
-
ExceptionTypeLike,
|
74
|
-
LoggerLike,
|
75
71
|
MaybeCallableBoolLike,
|
76
72
|
MaybeType,
|
77
73
|
PathLike,
|
@@ -369,8 +365,6 @@ async def get_items[T](queue: Queue[T], /, *, max_size: int | None = None) -> li
|
|
369
365
|
try:
|
370
366
|
items = [await queue.get()]
|
371
367
|
except RuntimeError as error: # pragma: no cover
|
372
|
-
from utilities.pytest import is_pytest
|
373
|
-
|
374
368
|
if (not is_pytest()) or (error.args[0] != "Event loop is closed"):
|
375
369
|
raise
|
376
370
|
return []
|
@@ -400,43 +394,6 @@ def get_items_nowait[T](queue: Queue[T], /, *, max_size: int | None = None) -> l
|
|
400
394
|
##
|
401
395
|
|
402
396
|
|
403
|
-
async def loop_until_succeed(
|
404
|
-
func: Callable[[], Coro[None]],
|
405
|
-
/,
|
406
|
-
*,
|
407
|
-
logger: LoggerLike | None = None,
|
408
|
-
errors: ExceptionTypeLike[Exception] | None = None,
|
409
|
-
sleep: Delta | None = None,
|
410
|
-
) -> bool:
|
411
|
-
"""Repeatedly call a coroutine until it succeeds."""
|
412
|
-
name = get_coroutine_name(func)
|
413
|
-
while True:
|
414
|
-
try:
|
415
|
-
await func()
|
416
|
-
except Exception as error: # noqa: BLE001
|
417
|
-
if logger is not None:
|
418
|
-
to_logger(logger).error("Error running %r", name, exc_info=True)
|
419
|
-
exc_type, exc_value, traceback = sys.exc_info()
|
420
|
-
if (exc_type is None) or (exc_value is None): # pragma: no cover
|
421
|
-
raise ImpossibleCaseError(
|
422
|
-
case=[f"{exc_type=}", f"{exc_value=}"]
|
423
|
-
) from None
|
424
|
-
sys.excepthook(exc_type, exc_value, traceback)
|
425
|
-
if (errors is not None) and is_instance_error(error, errors):
|
426
|
-
return False
|
427
|
-
if sleep is not None:
|
428
|
-
if logger is not None:
|
429
|
-
to_logger(logger).info("Sleeping for %s...", sleep)
|
430
|
-
await sleep_td(sleep)
|
431
|
-
if logger is not None:
|
432
|
-
to_logger(logger).info("Retrying %r...", name)
|
433
|
-
else:
|
434
|
-
return True
|
435
|
-
|
436
|
-
|
437
|
-
##
|
438
|
-
|
439
|
-
|
440
397
|
async def put_items[T](items: Iterable[T], queue: Queue[T], /) -> None:
|
441
398
|
"""Put items into a queue; if full then wait."""
|
442
399
|
for item in items:
|
@@ -589,7 +546,6 @@ __all__ = [
|
|
589
546
|
"get_coroutine_name",
|
590
547
|
"get_items",
|
591
548
|
"get_items_nowait",
|
592
|
-
"loop_until_succeed",
|
593
549
|
"put_items",
|
594
550
|
"put_items_nowait",
|
595
551
|
"sleep_max",
|
@@ -126,7 +126,15 @@ class GetEnvVarError(Exception):
|
|
126
126
|
|
127
127
|
def is_debug() -> bool:
|
128
128
|
"""Check if we are in `DEBUG` mode."""
|
129
|
-
return
|
129
|
+
return "DEBUG" in environ
|
130
|
+
|
131
|
+
|
132
|
+
##
|
133
|
+
|
134
|
+
|
135
|
+
def is_pytest() -> bool:
|
136
|
+
"""Check if `pytest` is running."""
|
137
|
+
return "PYTEST_VERSION" in environ
|
130
138
|
|
131
139
|
|
132
140
|
##
|
@@ -164,5 +172,6 @@ __all__ = [
|
|
164
172
|
"get_cpu_use",
|
165
173
|
"get_env_var",
|
166
174
|
"is_debug",
|
175
|
+
"is_pytest",
|
167
176
|
"temp_environ",
|
168
177
|
]
|
@@ -1,32 +1,27 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
-
from contextlib import
|
3
|
+
from contextlib import suppress
|
4
4
|
from dataclasses import dataclass
|
5
|
-
from functools import wraps
|
6
5
|
from sys import maxsize
|
7
6
|
from typing import TYPE_CHECKING, override
|
8
7
|
|
9
|
-
from pottery import AIORedlock
|
8
|
+
from pottery import AIORedlock
|
10
9
|
from pottery.exceptions import ReleaseUnlockedLock
|
11
10
|
from redis.asyncio import Redis
|
12
11
|
|
13
|
-
from utilities.asyncio import
|
12
|
+
from utilities.asyncio import sleep_td, timeout_td
|
14
13
|
from utilities.contextlib import enhanced_async_context_manager
|
15
|
-
from utilities.contextvars import yield_set_context
|
16
14
|
from utilities.iterables import always_iterable
|
17
|
-
from utilities.logging import to_logger
|
18
15
|
from utilities.whenever import MILLISECOND, SECOND, to_seconds
|
19
16
|
|
20
17
|
if TYPE_CHECKING:
|
21
|
-
from collections.abc import AsyncIterator,
|
22
|
-
from contextvars import ContextVar
|
18
|
+
from collections.abc import AsyncIterator, Iterable
|
23
19
|
|
24
20
|
from whenever import Delta
|
25
21
|
|
26
|
-
from utilities.types import
|
22
|
+
from utilities.types import MaybeIterable
|
27
23
|
|
28
24
|
_NUM: int = 1
|
29
|
-
_TIMEOUT_TRY_ACQUIRE: Delta = SECOND
|
30
25
|
_TIMEOUT_RELEASE: Delta = 10 * SECOND
|
31
26
|
_SLEEP: Delta = MILLISECOND
|
32
27
|
|
@@ -45,79 +40,6 @@ async def extend_lock(
|
|
45
40
|
##
|
46
41
|
|
47
42
|
|
48
|
-
@enhanced_async_context_manager
|
49
|
-
async def try_yield_coroutine_looper(
|
50
|
-
redis: MaybeIterable[Redis],
|
51
|
-
key: str,
|
52
|
-
/,
|
53
|
-
*,
|
54
|
-
num: int = _NUM,
|
55
|
-
timeout_release: Delta = _TIMEOUT_RELEASE,
|
56
|
-
num_extensions: int | None = None,
|
57
|
-
timeout_acquire: Delta = _TIMEOUT_TRY_ACQUIRE,
|
58
|
-
sleep_acquire: Delta = _SLEEP,
|
59
|
-
throttle: Delta | None = None,
|
60
|
-
logger: LoggerLike | None = None,
|
61
|
-
sleep_error: Delta | None = None,
|
62
|
-
context: ContextVar[bool] | None = None,
|
63
|
-
) -> AsyncIterator[CoroutineLooper | None]:
|
64
|
-
"""Try acquire access to a coroutine looper."""
|
65
|
-
try: # skipif-ci-and-not-linux
|
66
|
-
async with yield_access(
|
67
|
-
redis,
|
68
|
-
key,
|
69
|
-
num=num,
|
70
|
-
timeout_release=timeout_release,
|
71
|
-
num_extensions=num_extensions,
|
72
|
-
timeout_acquire=timeout_acquire,
|
73
|
-
sleep=sleep_acquire,
|
74
|
-
throttle=throttle,
|
75
|
-
) as lock:
|
76
|
-
looper = CoroutineLooper(lock=lock, logger=logger, sleep=sleep_error)
|
77
|
-
if context is None:
|
78
|
-
yield looper
|
79
|
-
else:
|
80
|
-
with yield_set_context(context):
|
81
|
-
yield looper
|
82
|
-
except _YieldAccessUnableToAcquireLockError as error: # skipif-ci-and-not-linux
|
83
|
-
if logger is not None:
|
84
|
-
to_logger(logger).info("%s", error)
|
85
|
-
async with nullcontext():
|
86
|
-
yield
|
87
|
-
|
88
|
-
|
89
|
-
@dataclass(order=True, unsafe_hash=True, kw_only=True)
|
90
|
-
class CoroutineLooper:
|
91
|
-
"""Looper, guarded by a lock, to repeatedly call a coroutine until it succeeds."""
|
92
|
-
|
93
|
-
lock: AIORedlock
|
94
|
-
logger: LoggerLike | None = None
|
95
|
-
sleep: Delta | None = None
|
96
|
-
|
97
|
-
async def __call__[**P](
|
98
|
-
self, func: Callable[P, Coro[None]], *args: P.args, **kwargs: P.kwargs
|
99
|
-
) -> bool:
|
100
|
-
return await loop_until_succeed(
|
101
|
-
lambda: self._make_coro(func, *args, **kwargs),
|
102
|
-
logger=self.logger,
|
103
|
-
errors=ExtendUnlockedLock,
|
104
|
-
sleep=self.sleep,
|
105
|
-
)
|
106
|
-
|
107
|
-
def _make_coro[**P](
|
108
|
-
self, func: Callable[P, Coro[None]], /, *args: P.args, **kwargs: P.kwargs
|
109
|
-
) -> Coro[None]:
|
110
|
-
@wraps(func)
|
111
|
-
async def wrapped() -> None:
|
112
|
-
await extend_lock(lock=self.lock)
|
113
|
-
return await func(*args, **kwargs)
|
114
|
-
|
115
|
-
return wrapped()
|
116
|
-
|
117
|
-
|
118
|
-
##
|
119
|
-
|
120
|
-
|
121
43
|
@enhanced_async_context_manager
|
122
44
|
async def yield_access(
|
123
45
|
redis: MaybeIterable[Redis],
|
@@ -212,10 +134,4 @@ class _YieldAccessUnableToAcquireLockError(YieldAccessError):
|
|
212
134
|
return f"Unable to acquire any 1 of {self.num} locks for {self.key!r} after {self.timeout}" # skipif-ci-and-not-linux
|
213
135
|
|
214
136
|
|
215
|
-
__all__ = [
|
216
|
-
"CoroutineLooper",
|
217
|
-
"YieldAccessError",
|
218
|
-
"extend_lock",
|
219
|
-
"try_yield_coroutine_looper",
|
220
|
-
"yield_access",
|
221
|
-
]
|
137
|
+
__all__ = ["YieldAccessError", "extend_lock", "yield_access"]
|
@@ -111,14 +111,6 @@ def add_pytest_configure(config: Config, options: Iterable[tuple[str, str]], /)
|
|
111
111
|
##
|
112
112
|
|
113
113
|
|
114
|
-
def is_pytest() -> bool:
|
115
|
-
"""Check if `pytest` is running."""
|
116
|
-
return "PYTEST_VERSION" in environ
|
117
|
-
|
118
|
-
|
119
|
-
##
|
120
|
-
|
121
|
-
|
122
114
|
def node_id_path(
|
123
115
|
node_id: str, /, *, root: PathLike | None = None, suffix: str | None = None
|
124
116
|
) -> Path:
|
@@ -257,7 +249,6 @@ __all__ = [
|
|
257
249
|
"add_pytest_addoption",
|
258
250
|
"add_pytest_collection_modifyitems",
|
259
251
|
"add_pytest_configure",
|
260
|
-
"is_pytest",
|
261
252
|
"node_id_path",
|
262
253
|
"skipif_linux",
|
263
254
|
"skipif_mac",
|
@@ -25,6 +25,7 @@ from utilities.contextlib import enhanced_async_context_manager
|
|
25
25
|
from utilities.errors import ImpossibleCaseError
|
26
26
|
from utilities.functions import ensure_int, identity
|
27
27
|
from utilities.iterables import always_iterable, one
|
28
|
+
from utilities.os import is_pytest
|
28
29
|
from utilities.whenever import MILLISECOND, SECOND, to_milliseconds, to_seconds
|
29
30
|
|
30
31
|
if TYPE_CHECKING:
|
@@ -730,8 +731,6 @@ async def subscribe[T](
|
|
730
731
|
try:
|
731
732
|
_ = task.cancel()
|
732
733
|
except RuntimeError as error: # pragma: no cover
|
733
|
-
from utilities.pytest import is_pytest
|
734
|
-
|
735
734
|
if (not is_pytest()) or (error.args[0] != "Event loop is closed"):
|
736
735
|
raise
|
737
736
|
with suppress(CancelledError):
|
@@ -95,6 +95,7 @@ from utilities.iterables import (
|
|
95
95
|
merge_str_mappings,
|
96
96
|
one,
|
97
97
|
)
|
98
|
+
from utilities.os import is_pytest
|
98
99
|
from utilities.reprlib import get_repr
|
99
100
|
from utilities.text import secret_str, snake_case
|
100
101
|
from utilities.types import (
|
@@ -976,8 +977,6 @@ async def yield_connection(
|
|
976
977
|
async with timeout_td(timeout, error=error), engine.begin() as conn:
|
977
978
|
yield conn
|
978
979
|
except GeneratorExit: # pragma: no cover
|
979
|
-
from utilities.pytest import is_pytest
|
980
|
-
|
981
980
|
if not is_pytest():
|
982
981
|
raise
|
983
982
|
return
|