dycw-utilities 0.127.0__tar.gz → 0.173.4__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.
Potentially problematic release.
This version of dycw-utilities might be problematic. Click here for more details.
- dycw_utilities-0.173.4/PKG-INFO +41 -0
- dycw_utilities-0.173.4/pyproject.toml +330 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/__init__.py +1 -1
- dycw_utilities-0.127.0/src/utilities/eventkit.py → dycw_utilities-0.173.4/src/utilities/aeventkit.py +46 -59
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/altair.py +11 -13
- dycw_utilities-0.173.4/src/utilities/asyncio.py +615 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/atomicwrites.py +18 -6
- dycw_utilities-0.173.4/src/utilities/atools.py +99 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/cachetools.py +24 -29
- dycw_utilities-0.173.4/src/utilities/click.py +685 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/concurrent.py +8 -11
- dycw_utilities-0.173.4/src/utilities/contextlib.py +243 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/contextvars.py +20 -1
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/cryptography.py +3 -3
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/dataclasses.py +83 -118
- dycw_utilities-0.173.4/src/utilities/docker.py +268 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/enum.py +26 -23
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/errors.py +17 -3
- dycw_utilities-0.173.4/src/utilities/fastapi.py +56 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/fpdf2.py +3 -3
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/functions.py +169 -416
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/functools.py +18 -19
- dycw_utilities-0.173.4/src/utilities/git.py +19 -0
- dycw_utilities-0.173.4/src/utilities/grp.py +28 -0
- dycw_utilities-0.173.4/src/utilities/gzip.py +31 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/http.py +3 -2
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/hypothesis.py +704 -599
- dycw_utilities-0.173.4/src/utilities/inflect.py +25 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/iterables.py +194 -262
- dycw_utilities-0.173.4/src/utilities/jinja2.py +148 -0
- dycw_utilities-0.173.4/src/utilities/json.py +70 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/libcst.py +38 -17
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/lightweight_charts.py +5 -9
- dycw_utilities-0.173.4/src/utilities/logging.py +629 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/math.py +18 -13
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/memory_profiler.py +11 -15
- dycw_utilities-0.173.4/src/utilities/more_itertools.py +397 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/operator.py +33 -29
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/optuna.py +6 -6
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/orjson.py +272 -137
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/os.py +61 -4
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/parse.py +59 -61
- dycw_utilities-0.173.4/src/utilities/pathlib.py +355 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/pickle.py +2 -2
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/platform.py +25 -6
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/polars.py +1212 -430
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/polars_ols.py +1 -1
- dycw_utilities-0.173.4/src/utilities/postgres.py +408 -0
- dycw_utilities-0.173.4/src/utilities/pottery.py +137 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/pqdm.py +10 -11
- dycw_utilities-0.173.4/src/utilities/psutil.py +64 -0
- dycw_utilities-0.173.4/src/utilities/pwd.py +28 -0
- dycw_utilities-0.173.4/src/utilities/pydantic.py +11 -0
- dycw_utilities-0.173.4/src/utilities/pydantic_settings.py +240 -0
- dycw_utilities-0.173.4/src/utilities/pydantic_settings_sops.py +76 -0
- dycw_utilities-0.173.4/src/utilities/pyinstrument.py +31 -0
- dycw_utilities-0.173.4/src/utilities/pytest.py +378 -0
- dycw_utilities-0.173.4/src/utilities/pytest_plugins/pytest_randomly.py +23 -0
- dycw_utilities-0.173.4/src/utilities/pytest_plugins/pytest_regressions.py +56 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/pytest_regressions.py +5 -45
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/random.py +13 -9
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/re.py +58 -28
- dycw_utilities-0.173.4/src/utilities/redis.py +922 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/scipy.py +1 -1
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/sentinel.py +10 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/shelve.py +4 -1
- dycw_utilities-0.173.4/src/utilities/shutil.py +25 -0
- dycw_utilities-0.173.4/src/utilities/slack_sdk.py +77 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/sqlalchemy.py +496 -521
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/sqlalchemy_polars.py +38 -94
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/string.py +2 -3
- dycw_utilities-0.173.4/src/utilities/subprocess.py +308 -0
- dycw_utilities-0.173.4/src/utilities/tempfile.py +112 -0
- dycw_utilities-0.173.4/src/utilities/testbook.py +50 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/text.py +165 -42
- dycw_utilities-0.173.4/src/utilities/timer.py +103 -0
- dycw_utilities-0.173.4/src/utilities/traceback.py +315 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/types.py +142 -117
- dycw_utilities-0.173.4/src/utilities/typing.py +953 -0
- dycw_utilities-0.173.4/src/utilities/tzdata.py +11 -0
- dycw_utilities-0.173.4/src/utilities/tzlocal.py +28 -0
- dycw_utilities-0.173.4/src/utilities/uuid.py +61 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/version.py +27 -34
- dycw_utilities-0.173.4/src/utilities/whenever.py +2088 -0
- dycw_utilities-0.173.4/src/utilities/zoneinfo.py +133 -0
- dycw_utilities-0.127.0/.gitignore +0 -169
- dycw_utilities-0.127.0/LICENSE +0 -21
- dycw_utilities-0.127.0/PKG-INFO +0 -242
- dycw_utilities-0.127.0/pyproject.toml +0 -535
- dycw_utilities-0.127.0/src/tests/__init__.py +0 -0
- dycw_utilities-0.127.0/src/tests/conftest.py +0 -357
- dycw_utilities-0.127.0/src/tests/modules/package_missing/__init__.py +0 -1
- dycw_utilities-0.127.0/src/tests/modules/package_missing/module.py +0 -5
- dycw_utilities-0.127.0/src/tests/modules/package_with/__init__.py +0 -1
- dycw_utilities-0.127.0/src/tests/modules/package_with/outer_1.py +0 -17
- dycw_utilities-0.127.0/src/tests/modules/package_with/outer_2.py +0 -17
- dycw_utilities-0.127.0/src/tests/modules/package_with/subpackage/__init__.py +0 -0
- dycw_utilities-0.127.0/src/tests/modules/package_with/subpackage/inner_1.py +0 -17
- dycw_utilities-0.127.0/src/tests/modules/package_with/subpackage/inner_2.py +0 -17
- dycw_utilities-0.127.0/src/tests/modules/package_with/subpackage/inner_3.py +0 -17
- dycw_utilities-0.127.0/src/tests/modules/package_without/__init__.py +0 -1
- dycw_utilities-0.127.0/src/tests/modules/package_without/module_1.py +0 -17
- dycw_utilities-0.127.0/src/tests/modules/package_without/module_2.py +0 -17
- dycw_utilities-0.127.0/src/tests/modules/standalone.py +0 -17
- dycw_utilities-0.127.0/src/tests/modules/with_imports.py +0 -7
- dycw_utilities-0.127.0/src/tests/regressions/test_pytest_regressions/TestMultipleRegressionFixtures__test_main__obj.json +0 -1
- dycw_utilities-0.127.0/src/tests/regressions/test_pytest_regressions/TestMultipleRegressionFixtures__test_main__series.json +0 -26
- dycw_utilities-0.127.0/src/tests/regressions/test_pytest_regressions/TestOrjsonRegressionFixture__test_dataclass_int.json +0 -1
- dycw_utilities-0.127.0/src/tests/regressions/test_pytest_regressions/TestOrjsonRegressionFixture__test_dataclass_literal__false.json +0 -1
- dycw_utilities-0.127.0/src/tests/regressions/test_pytest_regressions/TestOrjsonRegressionFixture__test_dataclass_literal__true.json +0 -1
- dycw_utilities-0.127.0/src/tests/regressions/test_pytest_regressions/TestOrjsonRegressionFixture__test_dataclass_nested.json +0 -5
- dycw_utilities-0.127.0/src/tests/regressions/test_pytest_regressions/TestPolarsRegressionFixture__test_dataframe.json +0 -25
- dycw_utilities-0.127.0/src/tests/regressions/test_pytest_regressions/TestPolarsRegressionFixture__test_series.json +0 -26
- dycw_utilities-0.127.0/src/tests/test_altair.py +0 -160
- dycw_utilities-0.127.0/src/tests/test_asyncio.py +0 -1571
- dycw_utilities-0.127.0/src/tests/test_asyncio_classes/__init__.py +0 -1
- dycw_utilities-0.127.0/src/tests/test_asyncio_classes/loopers.py +0 -310
- dycw_utilities-0.127.0/src/tests/test_asyncio_classes/redis.py +0 -28
- dycw_utilities-0.127.0/src/tests/test_atomicwrites.py +0 -223
- dycw_utilities-0.127.0/src/tests/test_atools.py +0 -35
- dycw_utilities-0.127.0/src/tests/test_cachetools.py +0 -74
- dycw_utilities-0.127.0/src/tests/test_click.py +0 -487
- dycw_utilities-0.127.0/src/tests/test_concurrent.py +0 -86
- dycw_utilities-0.127.0/src/tests/test_contextlib.py +0 -75
- dycw_utilities-0.127.0/src/tests/test_contextvars.py +0 -18
- dycw_utilities-0.127.0/src/tests/test_cryptography.py +0 -38
- dycw_utilities-0.127.0/src/tests/test_cvxpy.py +0 -649
- dycw_utilities-0.127.0/src/tests/test_dataclasses.py +0 -1010
- dycw_utilities-0.127.0/src/tests/test_datetime.py +0 -1347
- dycw_utilities-0.127.0/src/tests/test_enum.py +0 -222
- dycw_utilities-0.127.0/src/tests/test_errors.py +0 -52
- dycw_utilities-0.127.0/src/tests/test_eventkit.py +0 -286
- dycw_utilities-0.127.0/src/tests/test_fastapi.py +0 -24
- dycw_utilities-0.127.0/src/tests/test_fpdf2.py +0 -22
- dycw_utilities-0.127.0/src/tests/test_functions.py +0 -960
- dycw_utilities-0.127.0/src/tests/test_functools.py +0 -59
- dycw_utilities-0.127.0/src/tests/test_getpass.py +0 -8
- dycw_utilities-0.127.0/src/tests/test_git.py +0 -71
- dycw_utilities-0.127.0/src/tests/test_hashlib.py +0 -14
- dycw_utilities-0.127.0/src/tests/test_http.py +0 -20
- dycw_utilities-0.127.0/src/tests/test_hypothesis.py +0 -1253
- dycw_utilities-0.127.0/src/tests/test_importlib.py +0 -22
- dycw_utilities-0.127.0/src/tests/test_ipython.py +0 -15
- dycw_utilities-0.127.0/src/tests/test_iterables.py +0 -1425
- dycw_utilities-0.127.0/src/tests/test_jupyter.py +0 -64
- dycw_utilities-0.127.0/src/tests/test_libcst.py +0 -158
- dycw_utilities-0.127.0/src/tests/test_lightweight_charts.py +0 -64
- dycw_utilities-0.127.0/src/tests/test_logging.py +0 -706
- dycw_utilities-0.127.0/src/tests/test_loguru.py +0 -139
- dycw_utilities-0.127.0/src/tests/test_luigi.py +0 -101
- dycw_utilities-0.127.0/src/tests/test_math.py +0 -1381
- dycw_utilities-0.127.0/src/tests/test_memory_profiler.py +0 -21
- dycw_utilities-0.127.0/src/tests/test_modules.py +0 -144
- dycw_utilities-0.127.0/src/tests/test_more_itertools.py +0 -298
- dycw_utilities-0.127.0/src/tests/test_numpy.py +0 -1178
- dycw_utilities-0.127.0/src/tests/test_operator.py +0 -409
- dycw_utilities-0.127.0/src/tests/test_optuna.py +0 -76
- dycw_utilities-0.127.0/src/tests/test_orjson.py +0 -754
- dycw_utilities-0.127.0/src/tests/test_os.py +0 -142
- dycw_utilities-0.127.0/src/tests/test_parse.py +0 -700
- dycw_utilities-0.127.0/src/tests/test_pathlib.py +0 -60
- dycw_utilities-0.127.0/src/tests/test_period.py +0 -387
- dycw_utilities-0.127.0/src/tests/test_pickle.py +0 -21
- dycw_utilities-0.127.0/src/tests/test_platform.py +0 -87
- dycw_utilities-0.127.0/src/tests/test_polars.py +0 -2562
- dycw_utilities-0.127.0/src/tests/test_polars_ols.py +0 -114
- dycw_utilities-0.127.0/src/tests/test_pottery.py +0 -28
- dycw_utilities-0.127.0/src/tests/test_pqdm.py +0 -105
- dycw_utilities-0.127.0/src/tests/test_psutil.py +0 -50
- dycw_utilities-0.127.0/src/tests/test_pydantic.py +0 -57
- dycw_utilities-0.127.0/src/tests/test_pyinstrument.py +0 -19
- dycw_utilities-0.127.0/src/tests/test_pyrsistent.py +0 -49
- dycw_utilities-0.127.0/src/tests/test_pytest.py +0 -398
- dycw_utilities-0.127.0/src/tests/test_pytest_regressions.py +0 -74
- dycw_utilities-0.127.0/src/tests/test_python_dotenv.py +0 -132
- dycw_utilities-0.127.0/src/tests/test_random.py +0 -55
- dycw_utilities-0.127.0/src/tests/test_re.py +0 -121
- dycw_utilities-0.127.0/src/tests/test_redis.py +0 -746
- dycw_utilities-0.127.0/src/tests/test_reprlib.py +0 -87
- dycw_utilities-0.127.0/src/tests/test_scipy.py +0 -48
- dycw_utilities-0.127.0/src/tests/test_sentinel.py +0 -46
- dycw_utilities-0.127.0/src/tests/test_shelve.py +0 -23
- dycw_utilities-0.127.0/src/tests/test_slack_sdk.py +0 -110
- dycw_utilities-0.127.0/src/tests/test_socket.py +0 -8
- dycw_utilities-0.127.0/src/tests/test_sqlalchemy.py +0 -1482
- dycw_utilities-0.127.0/src/tests/test_sqlalchemy_polars.py +0 -662
- dycw_utilities-0.127.0/src/tests/test_statsmodel.py +0 -51
- dycw_utilities-0.127.0/src/tests/test_streamlit.py +0 -6
- dycw_utilities-0.127.0/src/tests/test_string.py +0 -52
- dycw_utilities-0.127.0/src/tests/test_sys.py +0 -134
- dycw_utilities-0.127.0/src/tests/test_tempfile.py +0 -31
- dycw_utilities-0.127.0/src/tests/test_tenacity.py +0 -113
- dycw_utilities-0.127.0/src/tests/test_text.py +0 -314
- dycw_utilities-0.127.0/src/tests/test_threading.py +0 -42
- dycw_utilities-0.127.0/src/tests/test_timer.py +0 -147
- dycw_utilities-0.127.0/src/tests/test_traceback.py +0 -605
- dycw_utilities-0.127.0/src/tests/test_traceback_funcs/__init__.py +0 -1
- dycw_utilities-0.127.0/src/tests/test_traceback_funcs/chain.py +0 -31
- dycw_utilities-0.127.0/src/tests/test_traceback_funcs/decorated_async.py +0 -89
- dycw_utilities-0.127.0/src/tests/test_traceback_funcs/decorated_sync.py +0 -93
- dycw_utilities-0.127.0/src/tests/test_traceback_funcs/error_bind.py +0 -17
- dycw_utilities-0.127.0/src/tests/test_traceback_funcs/many.py +0 -17
- dycw_utilities-0.127.0/src/tests/test_traceback_funcs/one.py +0 -17
- dycw_utilities-0.127.0/src/tests/test_traceback_funcs/recursive.py +0 -19
- dycw_utilities-0.127.0/src/tests/test_traceback_funcs/task_group_one.py +0 -34
- dycw_utilities-0.127.0/src/tests/test_traceback_funcs/task_group_two.py +0 -43
- dycw_utilities-0.127.0/src/tests/test_traceback_funcs/two.py +0 -27
- dycw_utilities-0.127.0/src/tests/test_traceback_funcs/untraced.py +0 -14
- dycw_utilities-0.127.0/src/tests/test_types.py +0 -65
- dycw_utilities-0.127.0/src/tests/test_typing.py +0 -720
- dycw_utilities-0.127.0/src/tests/test_typing_funcs/__init__.py +0 -0
- dycw_utilities-0.127.0/src/tests/test_typing_funcs/no_future.py +0 -35
- dycw_utilities-0.127.0/src/tests/test_typing_funcs/with_future.py +0 -177
- dycw_utilities-0.127.0/src/tests/test_tzdata.py +0 -60
- dycw_utilities-0.127.0/src/tests/test_tzlocal.py +0 -41
- dycw_utilities-0.127.0/src/tests/test_uuid.py +0 -37
- dycw_utilities-0.127.0/src/tests/test_version.py +0 -142
- dycw_utilities-0.127.0/src/tests/test_warnings.py +0 -74
- dycw_utilities-0.127.0/src/tests/test_whenever.py +0 -494
- dycw_utilities-0.127.0/src/tests/test_zipfile.py +0 -37
- dycw_utilities-0.127.0/src/tests/test_zoneinfo.py +0 -88
- dycw_utilities-0.127.0/src/utilities/asyncio.py +0 -1437
- dycw_utilities-0.127.0/src/utilities/atools.py +0 -44
- dycw_utilities-0.127.0/src/utilities/click.py +0 -528
- dycw_utilities-0.127.0/src/utilities/contextlib.py +0 -44
- dycw_utilities-0.127.0/src/utilities/datetime.py +0 -1417
- dycw_utilities-0.127.0/src/utilities/fastapi.py +0 -78
- dycw_utilities-0.127.0/src/utilities/git.py +0 -93
- dycw_utilities-0.127.0/src/utilities/logging.py +0 -817
- dycw_utilities-0.127.0/src/utilities/loguru.py +0 -144
- dycw_utilities-0.127.0/src/utilities/luigi.py +0 -228
- dycw_utilities-0.127.0/src/utilities/more_itertools.py +0 -328
- dycw_utilities-0.127.0/src/utilities/pathlib.py +0 -55
- dycw_utilities-0.127.0/src/utilities/period.py +0 -324
- dycw_utilities-0.127.0/src/utilities/pottery.py +0 -50
- dycw_utilities-0.127.0/src/utilities/psutil.py +0 -115
- dycw_utilities-0.127.0/src/utilities/pydantic.py +0 -61
- dycw_utilities-0.127.0/src/utilities/pyinstrument.py +0 -31
- dycw_utilities-0.127.0/src/utilities/pyrsistent.py +0 -89
- dycw_utilities-0.127.0/src/utilities/pytest.py +0 -272
- dycw_utilities-0.127.0/src/utilities/python_dotenv.py +0 -101
- dycw_utilities-0.127.0/src/utilities/redis.py +0 -1110
- dycw_utilities-0.127.0/src/utilities/slack_sdk.py +0 -190
- dycw_utilities-0.127.0/src/utilities/streamlit.py +0 -105
- dycw_utilities-0.127.0/src/utilities/sys.py +0 -87
- dycw_utilities-0.127.0/src/utilities/tempfile.py +0 -54
- dycw_utilities-0.127.0/src/utilities/tenacity.py +0 -145
- dycw_utilities-0.127.0/src/utilities/timer.py +0 -131
- dycw_utilities-0.127.0/src/utilities/traceback.py +0 -820
- dycw_utilities-0.127.0/src/utilities/typing.py +0 -493
- dycw_utilities-0.127.0/src/utilities/tzdata.py +0 -63
- dycw_utilities-0.127.0/src/utilities/tzlocal.py +0 -45
- dycw_utilities-0.127.0/src/utilities/uuid.py +0 -23
- dycw_utilities-0.127.0/src/utilities/whenever.py +0 -635
- dycw_utilities-0.127.0/src/utilities/zoneinfo.py +0 -71
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/README.md +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/cvxpy.py +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/getpass.py +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/hashlib.py +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/importlib.py +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/ipython.py +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/jupyter.py +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/modules.py +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/numpy.py +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/py.typed +0 -0
- {dycw_utilities-0.127.0/src/tests/modules → dycw_utilities-0.173.4/src/utilities/pytest_plugins}/__init__.py +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/reprlib.py +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/socket.py +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/statsmodels.py +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/threading.py +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/warnings.py +0 -0
- {dycw_utilities-0.127.0 → dycw_utilities-0.173.4}/src/utilities/zipfile.py +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: dycw-utilities
|
|
3
|
+
Version: 0.173.4
|
|
4
|
+
Author: Derek Wan
|
|
5
|
+
Author-email: Derek Wan <d.wan@icloud.com>
|
|
6
|
+
Requires-Dist: atomicwrites>=1.4.1,<1.5
|
|
7
|
+
Requires-Dist: typing-extensions>=4.15.0,<4.16
|
|
8
|
+
Requires-Dist: tzlocal>=5.3.1,<5.4
|
|
9
|
+
Requires-Dist: whenever>=0.9.4,<0.10
|
|
10
|
+
Requires-Dist: coloredlogs>=15.0.1,<15.1 ; extra == 'logging'
|
|
11
|
+
Requires-Dist: dycw-pytest-only>=2.1.1,<2.2 ; extra == 'test'
|
|
12
|
+
Requires-Dist: hypothesis>=6.148.8,<6.149 ; extra == 'test'
|
|
13
|
+
Requires-Dist: pytest>=9.0.2,<9.1 ; extra == 'test'
|
|
14
|
+
Requires-Dist: pytest-asyncio>=1.3.0,<1.4 ; extra == 'test'
|
|
15
|
+
Requires-Dist: pytest-cov>=7.0.0,<7.1 ; extra == 'test'
|
|
16
|
+
Requires-Dist: pytest-instafail>=0.5.0,<0.6 ; extra == 'test'
|
|
17
|
+
Requires-Dist: pytest-lazy-fixtures>=1.4.0,<1.5 ; extra == 'test'
|
|
18
|
+
Requires-Dist: pytest-randomly>=4.0.1,<4.1 ; extra == 'test'
|
|
19
|
+
Requires-Dist: pytest-regressions>=2.8.3,<2.9 ; extra == 'test'
|
|
20
|
+
Requires-Dist: pytest-repeat>=0.9.4,<0.10 ; extra == 'test'
|
|
21
|
+
Requires-Dist: pytest-rerunfailures>=16.1,<16.2 ; extra == 'test'
|
|
22
|
+
Requires-Dist: pytest-rng>=1.0.0,<1.1 ; extra == 'test'
|
|
23
|
+
Requires-Dist: pytest-timeout>=2.4.0,<2.5 ; extra == 'test'
|
|
24
|
+
Requires-Dist: pytest-xdist>=3.8.0,<3.9 ; extra == 'test'
|
|
25
|
+
Requires-Dist: testbook>=0.4.2,<0.5 ; extra == 'test'
|
|
26
|
+
Requires-Python: >=3.12
|
|
27
|
+
Provides-Extra: logging
|
|
28
|
+
Provides-Extra: test
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
[](https://badge.fury.io/py/dycw-utilities)
|
|
32
|
+
|
|
33
|
+
# `dycw-utilities`
|
|
34
|
+
|
|
35
|
+
[All the Python functions I don't want to write twice.](https://github.com/nvim-lua/plenary.nvim)
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
- `pip install dycw-utilities`
|
|
40
|
+
|
|
41
|
+
or with [extras](https://github.com/dycw/python-utilities/blob/master/pyproject.toml).
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
# build-system
|
|
2
|
+
[build-system]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
requires = ["uv_build"]
|
|
5
|
+
|
|
6
|
+
# dependency groups
|
|
7
|
+
[dependency-groups]
|
|
8
|
+
aeventkit = ["aeventkit >=2.1.0, <2.2"]
|
|
9
|
+
altair = ["altair >=5.5.0, <5.6"]
|
|
10
|
+
altair-test = ["polars", "img2pdf", "vl-convert-python"]
|
|
11
|
+
atools = ["atools >=0.14.2, <0.15"]
|
|
12
|
+
cachetools = ["cachetools >=6.2.4, <6.3"]
|
|
13
|
+
click = ["click >=8.3.1, <8.4"]
|
|
14
|
+
core = [
|
|
15
|
+
"atomicwrites >=1.4.1, <1.5",
|
|
16
|
+
"typing-extensions >=4.15.0, <4.16",
|
|
17
|
+
"tzlocal >=5.3.1, <5.4",
|
|
18
|
+
"whenever >=0.9.4, <0.10",
|
|
19
|
+
]
|
|
20
|
+
cryptography = ["cryptography >=46.0.3, <46.1"]
|
|
21
|
+
cvxpy = ["cvxpy >=1.7.5, <1.8"]
|
|
22
|
+
dataclasses-test = ["orjson", "polars"]
|
|
23
|
+
dev = [
|
|
24
|
+
"coloredlogs >=15.0.1, <15.1",
|
|
25
|
+
"coverage-conditional-plugin >=0.9.0, <0.10",
|
|
26
|
+
"dycw-pytest-only >=2.1.1, <2.2",
|
|
27
|
+
"pyright[nodejs] >=1.1.407, <1.2",
|
|
28
|
+
"pytest-cov >=7.0.0, <7.1",
|
|
29
|
+
"pytest-timeout >=2.4.0, <2.5",
|
|
30
|
+
]
|
|
31
|
+
fastapi = ["fastapi >=0.127.0, <0.128"]
|
|
32
|
+
fastapi-test = ["httpx", "uvicorn"]
|
|
33
|
+
fpdf2 = ["fpdf2 >=2.8.5, <2.9"]
|
|
34
|
+
gitpython = ["gitpython >=3.1.45, <3.2"]
|
|
35
|
+
hashlib-test = ["orjson"]
|
|
36
|
+
http-test = ["orjson"]
|
|
37
|
+
hypothesis = ["hypothesis >=6.148.8, <6.149"]
|
|
38
|
+
hypothesis-test = ["libcst", "numpy", "pathvalidate", "pytest-rerunfailures"]
|
|
39
|
+
inflect = ["inflect >=7.5.0, <7.6"]
|
|
40
|
+
jinja2 = ["jinja2 >=3.1.6, <3.2"]
|
|
41
|
+
jupyter-test = ["pandas", "polars"]
|
|
42
|
+
libcst = ["libcst >=1.8.6, <1.9"]
|
|
43
|
+
lightweight-charts = ["lightweight-charts >=2.1, <2.2"]
|
|
44
|
+
lightweight-charts-test = ["polars", "pyarrow"]
|
|
45
|
+
math-test = ["numpy"]
|
|
46
|
+
memory-profiler = ["memory-profiler >=0.61.0, <0.62"]
|
|
47
|
+
more-itertools = ["more-itertools >=10.8.0, <10.9"]
|
|
48
|
+
numpy = ["numpy >=2.4.0, <2.5"]
|
|
49
|
+
operator = ["polars"]
|
|
50
|
+
optuna = ["optuna >=4.6.0, <4.7"]
|
|
51
|
+
orjson = ["orjson >=3.11.5, <3.12"]
|
|
52
|
+
orjson-test = ["polars"]
|
|
53
|
+
polars = ["polars >=1.36.1, <1.37"]
|
|
54
|
+
polars-ols = ["polars-ols >=0.3.5, <0.4"]
|
|
55
|
+
polars-ols-test = ["scikit-learn"]
|
|
56
|
+
polars-test = ["numpy", "scipy", "statsmodels"]
|
|
57
|
+
pottery = ["pottery >=3.0.1, <3.1"]
|
|
58
|
+
pottery-test = ["orjson"]
|
|
59
|
+
pqdm = ["pqdm >=0.2.0, <0.3"]
|
|
60
|
+
psutil = ["psutil >=7.2.0, <7.3"]
|
|
61
|
+
pydantic = ["pydantic >=2.12.5, <2.13"]
|
|
62
|
+
pydantic-settings = ["pydantic-settings >=2.12.0, <2.13"]
|
|
63
|
+
pydantic-settings-sops = ["pydantic-settings-sops"]
|
|
64
|
+
pydantic-settings-test = ["pyyaml", "tomlkit"]
|
|
65
|
+
pyinstrument = ["pyinstrument >=5.1.1, <5.2"]
|
|
66
|
+
pytest = [
|
|
67
|
+
"pytest >=9.0.2, <9.1",
|
|
68
|
+
"pytest-asyncio >=1.3.0, <1.4",
|
|
69
|
+
"pytest-randomly >=4.0.1, <4.1",
|
|
70
|
+
"pytest-timeout >=2.4.0, <2.5",
|
|
71
|
+
"pytest-xdist >=3.8.0, <3.9",
|
|
72
|
+
]
|
|
73
|
+
pytest-regressions = ["pytest-regressions >=2.8.3, <2.9"]
|
|
74
|
+
pytest-regressions-test = ["orjson", "polars"]
|
|
75
|
+
pytest-test = ["orjson", "pytest-rerunfailures", "pytest-rng"]
|
|
76
|
+
redis = ["redis >=7.1.0, <7.2", "orjson"]
|
|
77
|
+
redis-test = ["pytest-rerunfailures"]
|
|
78
|
+
reprlib-test = ["rich"]
|
|
79
|
+
scipy = ["scipy >=1.16.3, <1.17"]
|
|
80
|
+
sklearn = ["scikit-learn >=1.8.0, <1.9"]
|
|
81
|
+
slack-sdk = ["slack-sdk >=3.39.0, <3.40"]
|
|
82
|
+
slack-sdk-test = ["aiohttp"]
|
|
83
|
+
sqlalchemy = ["sqlalchemy >=2.0.45, <2.1", "psycopg"]
|
|
84
|
+
sqlalchemy-polars = ["sqlalchemy", "polars"]
|
|
85
|
+
sqlalchemy-polars-test = ["aiosqlite", "asyncpg", "greenlet"]
|
|
86
|
+
sqlalchemy-test = ["aiosqlite", "asyncpg", "greenlet"]
|
|
87
|
+
statsmodels = ["statsmodels >=0.14.6, <0.15"]
|
|
88
|
+
testbook = ["testbook >=0.4.2, <0.5"]
|
|
89
|
+
tzdata = ["tzdata >=2025.3, <2025.4"]
|
|
90
|
+
whenever-test = ["pathvalidate"]
|
|
91
|
+
|
|
92
|
+
# project
|
|
93
|
+
[project]
|
|
94
|
+
authors = [{ email = "d.wan@icloud.com", name = "Derek Wan" }]
|
|
95
|
+
dependencies = [
|
|
96
|
+
"atomicwrites >=1.4.1, <1.5",
|
|
97
|
+
"typing-extensions >=4.15.0, <4.16",
|
|
98
|
+
"tzlocal >=5.3.1, <5.4",
|
|
99
|
+
"whenever >=0.9.4, <0.10",
|
|
100
|
+
]
|
|
101
|
+
name = "dycw-utilities"
|
|
102
|
+
readme = "README.md"
|
|
103
|
+
requires-python = ">= 3.12"
|
|
104
|
+
version = "0.173.4"
|
|
105
|
+
|
|
106
|
+
[project.entry-points.pytest11]
|
|
107
|
+
pytest-randomly = "utilities.pytest_plugins.pytest_randomly"
|
|
108
|
+
pytest-regressions = "utilities.pytest_plugins.pytest_regressions"
|
|
109
|
+
|
|
110
|
+
[project.optional-dependencies]
|
|
111
|
+
logging = ["coloredlogs >=15.0.1, <15.1"]
|
|
112
|
+
test = [
|
|
113
|
+
"dycw-pytest-only >=2.1.1, <2.2",
|
|
114
|
+
"hypothesis >=6.148.8, <6.149",
|
|
115
|
+
"pytest >=9.0.2, <9.1",
|
|
116
|
+
"pytest-asyncio >=1.3.0, <1.4",
|
|
117
|
+
"pytest-cov >=7.0.0, <7.1",
|
|
118
|
+
"pytest-instafail >=0.5.0, <0.6",
|
|
119
|
+
"pytest-lazy-fixtures >=1.4.0, <1.5",
|
|
120
|
+
"pytest-randomly >=4.0.1, <4.1",
|
|
121
|
+
"pytest-regressions >=2.8.3, <2.9",
|
|
122
|
+
"pytest-repeat >=0.9.4, <0.10",
|
|
123
|
+
"pytest-rerunfailures >=16.1, <16.2",
|
|
124
|
+
"pytest-rng >=1.0.0, <1.1",
|
|
125
|
+
"pytest-timeout >=2.4.0, <2.5",
|
|
126
|
+
"pytest-xdist >=3.8.0, <3.9",
|
|
127
|
+
"testbook >=0.4.2, <0.5",
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
[project.scripts]
|
|
131
|
+
|
|
132
|
+
# tool
|
|
133
|
+
[tool]
|
|
134
|
+
|
|
135
|
+
# bump-my-version
|
|
136
|
+
[tool.bumpversion]
|
|
137
|
+
allow_dirty = true
|
|
138
|
+
current_version = "0.173.4"
|
|
139
|
+
|
|
140
|
+
[[tool.bumpversion.files]]
|
|
141
|
+
filename = "src/utilities/__init__.py"
|
|
142
|
+
replace = "__version__ = \"{new_version}\""
|
|
143
|
+
search = "__version__ = \"{current_version}\""
|
|
144
|
+
|
|
145
|
+
# coverage
|
|
146
|
+
[tool.coverage]
|
|
147
|
+
[tool.coverage.coverage_conditional_plugin]
|
|
148
|
+
[tool.coverage.coverage_conditional_plugin.rules]
|
|
149
|
+
skipif-ci = '"CI" in os_environ'
|
|
150
|
+
skipif-ci-and-mac = '("CI" in os_environ) and (sys_platform == "darwin")'
|
|
151
|
+
skipif-ci-and-not-linux = '("CI" in os_environ) and (sys_platform != "linux")'
|
|
152
|
+
skipif-ci-or-mac = '("CI" in os_environ) or (sys_platform == "darwin")'
|
|
153
|
+
skipif-linux = 'sys_platform == "linux"'
|
|
154
|
+
skipif-mac = 'sys_platform == "darwin"'
|
|
155
|
+
skipif-not-linux = 'sys_platform != "linux"'
|
|
156
|
+
skipif-not-macos = 'sys_platform != "darwin"'
|
|
157
|
+
|
|
158
|
+
[tool.coverage.html]
|
|
159
|
+
directory = ".coverage/html"
|
|
160
|
+
|
|
161
|
+
[tool.coverage.report]
|
|
162
|
+
exclude_also = [
|
|
163
|
+
"@overload",
|
|
164
|
+
"assert_never",
|
|
165
|
+
"case never:",
|
|
166
|
+
"if TYPE_CHECKING:",
|
|
167
|
+
]
|
|
168
|
+
fail_under = 100.0
|
|
169
|
+
skip_covered = true
|
|
170
|
+
skip_empty = true
|
|
171
|
+
|
|
172
|
+
[tool.coverage.run]
|
|
173
|
+
branch = true
|
|
174
|
+
data_file = ".coverage/data"
|
|
175
|
+
omit = [
|
|
176
|
+
"src/utilities/__init__.py",
|
|
177
|
+
"src/utilities/pytest_plugins/*.py",
|
|
178
|
+
"src/utilities/streamlit.py",
|
|
179
|
+
]
|
|
180
|
+
parallel = true
|
|
181
|
+
plugins = ["coverage_conditional_plugin"]
|
|
182
|
+
source = ["src/utilities"]
|
|
183
|
+
|
|
184
|
+
# pyright
|
|
185
|
+
[tool.pyright]
|
|
186
|
+
deprecateTypingAliases = true
|
|
187
|
+
enableReachabilityAnalysis = false
|
|
188
|
+
ignore = ["**/_typeshed/**"]
|
|
189
|
+
pythonVersion = "3.12"
|
|
190
|
+
reportCallInDefaultInitializer = true
|
|
191
|
+
reportImplicitOverride = true
|
|
192
|
+
reportImplicitStringConcatenation = true
|
|
193
|
+
reportImportCycles = true
|
|
194
|
+
reportMissingSuperCall = true
|
|
195
|
+
reportMissingTypeArgument = false
|
|
196
|
+
reportMissingTypeStubs = false
|
|
197
|
+
reportPrivateUsage = false
|
|
198
|
+
reportPropertyTypeMismatch = true
|
|
199
|
+
reportUninitializedInstanceVariable = true
|
|
200
|
+
reportUnknownArgumentType = false
|
|
201
|
+
reportUnknownMemberType = false
|
|
202
|
+
reportUnknownParameterType = false
|
|
203
|
+
reportUnknownVariableType = false
|
|
204
|
+
reportUnnecessaryComparison = false
|
|
205
|
+
reportUnnecessaryTypeIgnoreComment = true
|
|
206
|
+
reportUnusedCallResult = true
|
|
207
|
+
reportUnusedImport = false
|
|
208
|
+
reportUnusedVariable = false
|
|
209
|
+
typeCheckingMode = "strict"
|
|
210
|
+
|
|
211
|
+
# pytest
|
|
212
|
+
[tool.pytest]
|
|
213
|
+
addopts = [
|
|
214
|
+
"-ra",
|
|
215
|
+
"-vv",
|
|
216
|
+
"--color=auto",
|
|
217
|
+
"--durations=10",
|
|
218
|
+
"--durations-min=10",
|
|
219
|
+
"--timeout=600",
|
|
220
|
+
]
|
|
221
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
222
|
+
asyncio_mode = "auto"
|
|
223
|
+
collect_imported_tests = false
|
|
224
|
+
empty_parameter_set_mark = "fail_at_collect"
|
|
225
|
+
filterwarnings = [
|
|
226
|
+
"error",
|
|
227
|
+
"ignore:<aiosqlite.*core.*Connection .*> was delete before being closed:ResourceWarning", # sqlalchemy
|
|
228
|
+
"ignore:Exception ignored in.* <coroutine object .* at .*>:pytest.PytestUnraisableExceptionWarning",
|
|
229
|
+
"ignore:Exception in thread Thread-.*:pytest.PytestUnhandledThreadExceptionWarning",
|
|
230
|
+
"ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning", # jupyter
|
|
231
|
+
"ignore:ResourceTracker called reentrantly for resource cleanup, which is unsupported:UserWarning",
|
|
232
|
+
"ignore:The garbage collector is trying to clean up non-checked-in connection <AdaptedConnection <Connection(.*)>:RuntimeWarning", # sqlalchemy
|
|
233
|
+
"ignore:Using fork.* can cause Polars to deadlock in the child process:RuntimeWarning", # polars/pqdm
|
|
234
|
+
"ignore:coroutine 'AsyncConnection.close' was never awaited:RuntimeWarning",
|
|
235
|
+
"ignore:loop is closed:ResourceWarning", # redis
|
|
236
|
+
"ignore:unclosed <StreamWriter .*>:ResourceWarning", # redis
|
|
237
|
+
"ignore:unclosed <socket.*socket .*>:ResourceWarning", # redis
|
|
238
|
+
"ignore:unclosed Connection <redis.*asyncio.*connection.*Connection.*>:ResourceWarning", # redis
|
|
239
|
+
"ignore:unclosed connection <asyncpg.*connection.*Connection.*>:ResourceWarning", # asyncpg
|
|
240
|
+
"ignore:unclosed database in <sqlite3.*Connection .*>:ResourceWarning", # sqlalchemy
|
|
241
|
+
"ignore:unclosed event loop <_UnixSelectorEventLoop .*>:ResourceWarning", # redis
|
|
242
|
+
"ignore:unclosed file <_io.*TextIOWrapper .*>:ResourceWarning", # logging
|
|
243
|
+
"ignore:unclosed transport <_SelectorSocketTransport .*>:ResourceWarning", # redis
|
|
244
|
+
"ignore:Do not expect file_or_dir in Namespace:UserWarning", # pytest
|
|
245
|
+
]
|
|
246
|
+
minversion = "9.0"
|
|
247
|
+
strict = true
|
|
248
|
+
testpaths = ["src/tests"]
|
|
249
|
+
timeout = "600"
|
|
250
|
+
xfail_strict = true
|
|
251
|
+
|
|
252
|
+
# ruff
|
|
253
|
+
[tool.ruff]
|
|
254
|
+
src = ["src"]
|
|
255
|
+
target-version = "py312"
|
|
256
|
+
unsafe-fixes = true
|
|
257
|
+
|
|
258
|
+
[tool.ruff.format]
|
|
259
|
+
preview = true
|
|
260
|
+
skip-magic-trailing-comma = true
|
|
261
|
+
|
|
262
|
+
[tool.ruff.lint]
|
|
263
|
+
explicit-preview-rules = true
|
|
264
|
+
fixable = ["ALL"]
|
|
265
|
+
ignore = [
|
|
266
|
+
"ANN401", # any-type
|
|
267
|
+
"A005", # stdlib-module-shadowing
|
|
268
|
+
"ASYNC109", # async-function-with-timeout
|
|
269
|
+
"C901", # complex-structure
|
|
270
|
+
"CPY", # flake8-copyright
|
|
271
|
+
"D", # pydocstyle
|
|
272
|
+
"DOC", # pydoclint
|
|
273
|
+
"E501", # line-too-long
|
|
274
|
+
"PD", # pandas-vet
|
|
275
|
+
"PERF203", # try-except-in-loop
|
|
276
|
+
"PLC0415", # import-outside-top-level
|
|
277
|
+
"PLR0911", # too-many-return-statements
|
|
278
|
+
"PLR0912", # too-many-branches
|
|
279
|
+
"PLR0913", # too-many-arguments
|
|
280
|
+
"PLR0915", # too-many-statements
|
|
281
|
+
"PLR2004", # magic-value-comparison
|
|
282
|
+
"PT012", # pytest-raises-with-multiple-statements
|
|
283
|
+
"PT013", # pytest-incorrect-pytest-import
|
|
284
|
+
"S202", # tarfile-unsafe-members
|
|
285
|
+
"S310", # suspicious-url-open-usage
|
|
286
|
+
"S311", # suspicious-non-cryptographic-random-usage
|
|
287
|
+
"S602", # subprocess-popen-with-shell-equals-true
|
|
288
|
+
"S603", # subprocess-without-shell-equals-true
|
|
289
|
+
"S607", # start-process-with-partial-path
|
|
290
|
+
# preview
|
|
291
|
+
"S101", # assert
|
|
292
|
+
# formatter
|
|
293
|
+
"W191", # tab-indentation
|
|
294
|
+
"E111", # indentation-with-invalid-multiple
|
|
295
|
+
"E114", # indentation-with-invalid-multiple-comment
|
|
296
|
+
"E117", # over-indented
|
|
297
|
+
"COM812", # missing-trailing-comma
|
|
298
|
+
"COM819", # prohibited-trailing-comma
|
|
299
|
+
"ISC001", # single-line-implicit-string-concatenation
|
|
300
|
+
"ISC002", # multi-line-implicit-string-concatenation
|
|
301
|
+
]
|
|
302
|
+
preview = true
|
|
303
|
+
select = [
|
|
304
|
+
"ALL",
|
|
305
|
+
"RUF022", # unsorted-dunder-all
|
|
306
|
+
]
|
|
307
|
+
|
|
308
|
+
[tool.ruff.lint.extend-per-file-ignores]
|
|
309
|
+
"src/tests/**/*.py" = [
|
|
310
|
+
"S101", # assert
|
|
311
|
+
"SLF001", # private-member-access
|
|
312
|
+
]
|
|
313
|
+
"src/tests/test_typing_funcs/no_future.py" = [
|
|
314
|
+
"I002",
|
|
315
|
+
] # missing-required-import
|
|
316
|
+
|
|
317
|
+
[tool.ruff.lint.flake8-tidy-imports]
|
|
318
|
+
ban-relative-imports = "all"
|
|
319
|
+
|
|
320
|
+
[tool.ruff.lint.isort]
|
|
321
|
+
required-imports = ["from __future__ import annotations"]
|
|
322
|
+
split-on-trailing-comma = false
|
|
323
|
+
|
|
324
|
+
# uv
|
|
325
|
+
[tool.uv]
|
|
326
|
+
default-groups = "all"
|
|
327
|
+
|
|
328
|
+
[tool.uv.build-backend]
|
|
329
|
+
module-name = "utilities"
|
|
330
|
+
module-root = "src"
|
dycw_utilities-0.127.0/src/utilities/eventkit.py → dycw_utilities-0.173.4/src/utilities/aeventkit.py
RENAMED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from asyncio import iscoroutinefunction
|
|
4
3
|
from dataclasses import dataclass
|
|
5
4
|
from functools import wraps
|
|
6
|
-
from
|
|
7
|
-
|
|
8
|
-
Any,
|
|
9
|
-
Generic,
|
|
10
|
-
Self,
|
|
11
|
-
TypeVar,
|
|
12
|
-
assert_never,
|
|
13
|
-
cast,
|
|
14
|
-
override,
|
|
15
|
-
)
|
|
5
|
+
from inspect import iscoroutinefunction
|
|
6
|
+
from typing import TYPE_CHECKING, Any, Self, assert_never, cast, override
|
|
16
7
|
|
|
17
8
|
from eventkit import (
|
|
18
9
|
Constant,
|
|
@@ -38,33 +29,29 @@ from eventkit import (
|
|
|
38
29
|
|
|
39
30
|
from utilities.functions import apply_decorators
|
|
40
31
|
from utilities.iterables import always_iterable
|
|
41
|
-
from utilities.logging import
|
|
42
|
-
from utilities.types import TCallable, TCallableMaybeCoroutine1None, TypeLike
|
|
32
|
+
from utilities.logging import to_logger
|
|
43
33
|
|
|
44
34
|
if TYPE_CHECKING:
|
|
45
35
|
from collections.abc import Callable
|
|
46
36
|
|
|
47
|
-
from utilities.types import
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
_TEvent = TypeVar("_TEvent", bound=Event)
|
|
37
|
+
from utilities.types import Coro, LoggerLike, MaybeCoro, MaybeIterable, TypeLike
|
|
51
38
|
|
|
52
39
|
|
|
53
40
|
##
|
|
54
41
|
|
|
55
42
|
|
|
56
|
-
def add_listener(
|
|
57
|
-
event:
|
|
58
|
-
listener: Callable[...,
|
|
43
|
+
def add_listener[E: Event, F: Callable](
|
|
44
|
+
event: E,
|
|
45
|
+
listener: Callable[..., MaybeCoro[None]],
|
|
59
46
|
/,
|
|
60
47
|
*,
|
|
61
|
-
error: Callable[[Event, BaseException],
|
|
48
|
+
error: Callable[[Event, BaseException], MaybeCoro[None]] | None = None,
|
|
62
49
|
ignore: TypeLike[BaseException] | None = None,
|
|
63
|
-
logger:
|
|
64
|
-
decorators: MaybeIterable[Callable[[
|
|
65
|
-
done: Callable[...,
|
|
50
|
+
logger: LoggerLike | None = None,
|
|
51
|
+
decorators: MaybeIterable[Callable[[F], F]] | None = None,
|
|
52
|
+
done: Callable[..., MaybeCoro[None]] | None = None,
|
|
66
53
|
keep_ref: bool = False,
|
|
67
|
-
) ->
|
|
54
|
+
) -> E:
|
|
68
55
|
"""Connect a listener to an event."""
|
|
69
56
|
lifted = lift_listener(
|
|
70
57
|
listener,
|
|
@@ -74,14 +61,14 @@ def add_listener(
|
|
|
74
61
|
logger=logger,
|
|
75
62
|
decorators=decorators,
|
|
76
63
|
)
|
|
77
|
-
return cast("
|
|
64
|
+
return cast("E", event.connect(lifted, done=done, keep_ref=keep_ref))
|
|
78
65
|
|
|
79
66
|
|
|
80
67
|
##
|
|
81
68
|
|
|
82
69
|
|
|
83
70
|
@dataclass(repr=False, kw_only=True)
|
|
84
|
-
class LiftedEvent
|
|
71
|
+
class LiftedEvent[F: Callable[..., MaybeCoro[None]]]:
|
|
85
72
|
"""A lifted version of `Event`."""
|
|
86
73
|
|
|
87
74
|
event: Event
|
|
@@ -98,16 +85,16 @@ class LiftedEvent(Generic[TCallableMaybeCoroutine1None]):
|
|
|
98
85
|
def value(self) -> Any:
|
|
99
86
|
return self.event.value() # pragma: no cover
|
|
100
87
|
|
|
101
|
-
def connect(
|
|
88
|
+
def connect[F2: Callable](
|
|
102
89
|
self,
|
|
103
|
-
listener:
|
|
90
|
+
listener: F,
|
|
104
91
|
/,
|
|
105
92
|
*,
|
|
106
|
-
error: Callable[[Event, BaseException],
|
|
93
|
+
error: Callable[[Event, BaseException], MaybeCoro[None]] | None = None,
|
|
107
94
|
ignore: TypeLike[BaseException] | None = None,
|
|
108
|
-
logger:
|
|
109
|
-
decorators: MaybeIterable[Callable[[
|
|
110
|
-
done: Callable[...,
|
|
95
|
+
logger: LoggerLike | None = None,
|
|
96
|
+
decorators: MaybeIterable[Callable[[F2], F2]] | None = None,
|
|
97
|
+
done: Callable[..., MaybeCoro[None]] | None = None,
|
|
111
98
|
keep_ref: bool = False,
|
|
112
99
|
) -> Event:
|
|
113
100
|
return add_listener(
|
|
@@ -182,7 +169,8 @@ class LiftedEvent(Generic[TCallableMaybeCoroutine1None]):
|
|
|
182
169
|
def __await__(self) -> Any:
|
|
183
170
|
return self.event.__await__() # pragma: no cover
|
|
184
171
|
|
|
185
|
-
__aiter__
|
|
172
|
+
def __aiter__(self) -> Any:
|
|
173
|
+
return self.event.aiter() # pragma: no cover
|
|
186
174
|
|
|
187
175
|
def __contains__(self, c: Any, /) -> bool:
|
|
188
176
|
return self.event.__contains__(c) # pragma: no cover
|
|
@@ -256,26 +244,26 @@ class LiftedEvent(Generic[TCallableMaybeCoroutine1None]):
|
|
|
256
244
|
##
|
|
257
245
|
|
|
258
246
|
|
|
259
|
-
class TypedEvent
|
|
247
|
+
class TypedEvent[F: Callable[..., MaybeCoro[None]]](Event):
|
|
260
248
|
"""A typed version of `Event`."""
|
|
261
249
|
|
|
262
250
|
@override
|
|
263
|
-
def connect(
|
|
251
|
+
def connect[F2: Callable](
|
|
264
252
|
self,
|
|
265
|
-
listener:
|
|
266
|
-
error: Callable[[Self, BaseException],
|
|
267
|
-
done: Callable[[Self],
|
|
253
|
+
listener: F,
|
|
254
|
+
error: Callable[[Self, BaseException], MaybeCoro[None]] | None = None,
|
|
255
|
+
done: Callable[[Self], MaybeCoro[None]] | None = None,
|
|
268
256
|
keep_ref: bool = False,
|
|
269
257
|
*,
|
|
270
258
|
ignore: TypeLike[BaseException] | None = None,
|
|
271
|
-
logger:
|
|
272
|
-
decorators: MaybeIterable[Callable[[
|
|
259
|
+
logger: LoggerLike | None = None,
|
|
260
|
+
decorators: MaybeIterable[Callable[[F2], F2]] | None = None,
|
|
273
261
|
) -> Self:
|
|
274
262
|
lifted = lift_listener(
|
|
275
263
|
listener,
|
|
276
264
|
self,
|
|
277
265
|
error=cast(
|
|
278
|
-
"Callable[[Event, BaseException],
|
|
266
|
+
"Callable[[Event, BaseException], MaybeCoro[None]] | None", error
|
|
279
267
|
),
|
|
280
268
|
ignore=ignore,
|
|
281
269
|
logger=logger,
|
|
@@ -289,16 +277,16 @@ class TypedEvent(Event, Generic[TCallableMaybeCoroutine1None]):
|
|
|
289
277
|
##
|
|
290
278
|
|
|
291
279
|
|
|
292
|
-
def lift_listener(
|
|
293
|
-
listener:
|
|
280
|
+
def lift_listener[F1: Callable[..., MaybeCoro[None]], F2: Callable](
|
|
281
|
+
listener: F1,
|
|
294
282
|
event: Event,
|
|
295
283
|
/,
|
|
296
284
|
*,
|
|
297
|
-
error: Callable[[Event, BaseException],
|
|
285
|
+
error: Callable[[Event, BaseException], MaybeCoro[None]] | None = None,
|
|
298
286
|
ignore: TypeLike[BaseException] | None = None,
|
|
299
|
-
logger:
|
|
300
|
-
decorators: MaybeIterable[Callable[[
|
|
301
|
-
) ->
|
|
287
|
+
logger: LoggerLike | None = None,
|
|
288
|
+
decorators: MaybeIterable[Callable[[F2], F2]] | None = None,
|
|
289
|
+
) -> F1:
|
|
302
290
|
match error, bool(iscoroutinefunction(listener)):
|
|
303
291
|
case None, False:
|
|
304
292
|
listener_typed = cast("Callable[..., None]", listener)
|
|
@@ -310,12 +298,12 @@ def lift_listener(
|
|
|
310
298
|
except Exception as exc: # noqa: BLE001
|
|
311
299
|
if (ignore is not None) and isinstance(exc, ignore):
|
|
312
300
|
return
|
|
313
|
-
|
|
301
|
+
to_logger(logger).exception("")
|
|
314
302
|
|
|
315
303
|
lifted = listener_no_error_sync
|
|
316
304
|
|
|
317
305
|
case None, True:
|
|
318
|
-
listener_typed = cast("Callable[...,
|
|
306
|
+
listener_typed = cast("Callable[..., Coro[None]]", listener)
|
|
319
307
|
|
|
320
308
|
@wraps(listener)
|
|
321
309
|
async def listener_no_error_async(*args: Any, **kwargs: Any) -> None:
|
|
@@ -324,7 +312,7 @@ def lift_listener(
|
|
|
324
312
|
except Exception as exc: # noqa: BLE001
|
|
325
313
|
if (ignore is not None) and isinstance(exc, ignore):
|
|
326
314
|
return
|
|
327
|
-
|
|
315
|
+
to_logger(logger).exception("")
|
|
328
316
|
|
|
329
317
|
lifted = listener_no_error_async
|
|
330
318
|
case _, _:
|
|
@@ -346,11 +334,11 @@ def lift_listener(
|
|
|
346
334
|
case False, True:
|
|
347
335
|
listener_typed = cast("Callable[..., None]", listener)
|
|
348
336
|
error_typed = cast(
|
|
349
|
-
"Callable[[Event, Exception],
|
|
337
|
+
"Callable[[Event, Exception], Coro[None]]", error
|
|
350
338
|
)
|
|
351
339
|
raise LiftListenerError(listener=listener_typed, error=error_typed)
|
|
352
340
|
case True, _:
|
|
353
|
-
listener_typed = cast("Callable[...,
|
|
341
|
+
listener_typed = cast("Callable[..., Coro[None]]", listener)
|
|
354
342
|
|
|
355
343
|
@wraps(listener)
|
|
356
344
|
async def listener_have_error_async(
|
|
@@ -363,8 +351,7 @@ def lift_listener(
|
|
|
363
351
|
return None
|
|
364
352
|
if iscoroutinefunction(error):
|
|
365
353
|
error_typed = cast(
|
|
366
|
-
"Callable[[Event, Exception],
|
|
367
|
-
error,
|
|
354
|
+
"Callable[[Event, Exception], Coro[None]]", error
|
|
368
355
|
)
|
|
369
356
|
return await error_typed(event, exc)
|
|
370
357
|
error_typed = cast(
|
|
@@ -373,20 +360,20 @@ def lift_listener(
|
|
|
373
360
|
error_typed(event, exc)
|
|
374
361
|
|
|
375
362
|
lifted = listener_have_error_async
|
|
376
|
-
case
|
|
363
|
+
case never:
|
|
377
364
|
assert_never(never)
|
|
378
|
-
case
|
|
365
|
+
case never:
|
|
379
366
|
assert_never(never)
|
|
380
367
|
|
|
381
368
|
if decorators is not None:
|
|
382
369
|
lifted = apply_decorators(lifted, *always_iterable(decorators))
|
|
383
|
-
return lifted
|
|
370
|
+
return cast("F1", lifted)
|
|
384
371
|
|
|
385
372
|
|
|
386
373
|
@dataclass(kw_only=True, slots=True)
|
|
387
374
|
class LiftListenerError(Exception):
|
|
388
375
|
listener: Callable[..., None]
|
|
389
|
-
error: Callable[[Event, Exception],
|
|
376
|
+
error: Callable[[Event, Exception], Coro[None]]
|
|
390
377
|
|
|
391
378
|
@override
|
|
392
379
|
def __str__(self) -> str:
|