omlish 0.0.0.dev0__tar.gz → 0.0.0.dev2__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 omlish might be problematic. Click here for more details.
- omlish-0.0.0.dev2/MANIFEST.in +1 -0
- omlish-0.0.0.dev2/PKG-INFO +30 -0
- omlish-0.0.0.dev2/omlish/__about__.py +7 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/argparse.py +4 -4
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/asyncs/__init__.py +10 -5
- omlish-0.0.0.dev2/omlish/asyncs/anyio.py +84 -0
- omlish-0.0.0.dev2/omlish/asyncs/asyncs.py +76 -0
- omlish-0.0.0.dev0/omlish/asyncs/asyncs.py → omlish-0.0.0.dev2/omlish/asyncs/futures.py +56 -102
- omlish-0.0.0.dev2/omlish/asyncs/trio.py +11 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/c3.py +4 -4
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/check.py +6 -6
- omlish-0.0.0.dev2/omlish/collections/__init__.py +98 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/cache/descriptor.py +5 -5
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/cache/impl.py +4 -4
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/coerce.py +43 -43
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/frozen.py +3 -3
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/identity.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/mappings.py +3 -3
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/ordered.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/skiplist.py +6 -6
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/sorted.py +3 -3
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/treap.py +17 -17
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/treapmap.py +2 -2
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/unmodifiable.py +28 -27
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/configs/flattening.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/configs/props.py +1 -1
- omlish-0.0.0.dev2/omlish/dataclasses/impl/__init__.py +8 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/api.py +5 -13
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/fields.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/init.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/internals.py +15 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/main.py +5 -5
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/metaclass.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/metadata.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/order.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/params.py +4 -38
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/reflect.py +1 -7
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/replace.py +8 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/repr.py +23 -5
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/simple.py +2 -8
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/slots.py +2 -2
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/utils.py +4 -4
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dispatch/dispatch.py +9 -8
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dispatch/methods.py +2 -2
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/docker.py +8 -6
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dynamic.py +5 -5
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/graphs/dot/items.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/graphs/trees.py +15 -21
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/http/consts.py +6 -5
- omlish-0.0.0.dev2/omlish/http/wsgi.py +34 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/elements.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/exceptions.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/impl/injector.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/impl/inspect.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/injector.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/providers.py +2 -2
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/iterators.py +43 -2
- omlish-0.0.0.dev2/omlish/lang/__init__.py +167 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/cached.py +13 -5
- omlish-0.0.0.dev2/omlish/lang/classes/__init__.py +35 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/classes/abstract.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/classes/simple.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/clsdct.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/contextmanagers.py +23 -15
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/datetimes.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/descriptors.py +35 -2
- omlish-0.0.0.dev2/omlish/lang/exceptions.py +2 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/functions.py +43 -13
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/imports.py +8 -8
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/iterables.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/maybes.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/objects.py +2 -2
- omlish-0.0.0.dev2/omlish/lang/timeouts.py +53 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/typing.py +2 -2
- omlish-0.0.0.dev2/omlish/libc.py +532 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/base.py +6 -6
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/dataclasses.py +2 -2
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/enums.py +2 -2
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/factories.py +10 -10
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/iterables.py +2 -2
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/mappings.py +2 -2
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/optionals.py +4 -4
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/polymorphism.py +4 -4
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/standard.py +6 -6
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/utils.py +1 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/os.py +13 -4
- omlish-0.0.0.dev2/omlish/procfs.py +336 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/reflect.py +2 -12
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/replserver/console.py +9 -9
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/replserver/server.py +13 -5
- omlish-0.0.0.dev2/omlish/sql/_abcs.py +65 -0
- omlish-0.0.0.dev2/omlish/sql/dbs.py +90 -0
- omlish-0.0.0.dev2/omlish/stats.py +342 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/testing/pydevd.py +43 -6
- omlish-0.0.0.dev2/omlish/testing/pytest/inject/__init__.py +8 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/testing/pytest/inject/harness.py +23 -1
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/testing/pytest/plugins/__init__.py +1 -1
- omlish-0.0.0.dev2/omlish/testing/pytest/plugins/pydevd.py +12 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/testing/pytest/plugins/switches.py +2 -2
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/testing/testing.py +5 -5
- omlish-0.0.0.dev2/omlish/text/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/text/parts.py +3 -3
- omlish-0.0.0.dev2/omlish.egg-info/PKG-INFO +30 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish.egg-info/SOURCES.txt +13 -6
- omlish-0.0.0.dev2/omlish.egg-info/requires.txt +24 -0
- omlish-0.0.0.dev2/pyproject.toml +200 -0
- omlish-0.0.0.dev0/MANIFEST.in +0 -3
- omlish-0.0.0.dev0/PKG-INFO +0 -16
- omlish-0.0.0.dev0/omlish/__about__.py +0 -23
- omlish-0.0.0.dev0/omlish/asyncs/anyio.py +0 -13
- omlish-0.0.0.dev0/omlish/collections/__init__.py +0 -63
- omlish-0.0.0.dev0/omlish/conftest.py +0 -6
- omlish-0.0.0.dev0/omlish/dataclasses/LICENSE +0 -279
- omlish-0.0.0.dev0/omlish/dataclasses/impl/__init__.py +0 -6
- omlish-0.0.0.dev0/omlish/http/types.py +0 -42
- omlish-0.0.0.dev0/omlish/inject/.DS_Store +0 -0
- omlish-0.0.0.dev0/omlish/lang/__init__.py +0 -112
- omlish-0.0.0.dev0/omlish/lang/classes/__init__.py +0 -24
- omlish-0.0.0.dev0/omlish/testing/pytest/inject/__init__.py +0 -1
- omlish-0.0.0.dev0/omlish/testing/pytest/plugins/pycharm.py +0 -54
- omlish-0.0.0.dev0/omlish.egg-info/PKG-INFO +0 -16
- omlish-0.0.0.dev0/pyproject.toml +0 -119
- omlish-0.0.0.dev0/setup.py +0 -49
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/LICENSE +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/README.md +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/asyncs/asyncio.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/cached.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/_abc.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/_io_abc.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/cache/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/cache/types.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/indexed.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/persistent.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/collections/utils.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/configs/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/as_.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/exceptions.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/frozen.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/hashing.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dataclasses/impl/processing.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/defs.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dispatch/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/dispatch/functions.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/graphs/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/graphs/dot/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/graphs/dot/rendering.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/graphs/dot/utils.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/http/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/binder.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/bindings.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/eagers.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/impl/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/impl/bindings.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/impl/elements.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/impl/private.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/impl/providers.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/impl/scopes.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/inspect.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/keys.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/managed.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/overrides.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/private.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/proxy.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/scopes.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/inject/types.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/json.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/classes/restrict.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/classes/test/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/classes/test/test_abstract.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/classes/test/test_restrict.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/classes/test/test_simple.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/classes/test/test_virtual.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/classes/virtual.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/cmp.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/resolving.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/lang/strings.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/logs/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/logs/_abc.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/logs/configs.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/logs/filters.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/logs/formatters.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/logs/utils.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/any.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/base64.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/datetimes.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/exceptions.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/global_.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/naming.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/objects.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/primitives.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/registries.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/uuids.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/marshal/values.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/math.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/replserver/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/replserver/__main__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/runmodule.py +0 -0
- {omlish-0.0.0.dev0/omlish/text → omlish-0.0.0.dev2/omlish/sql}/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/term.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/testing/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/testing/pytest/__init__.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/testing/pytest/helpers.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/testing/pytest/plugins/_registry.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/testing/pytest/plugins/logging.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/testing/pytest/plugins/repeat.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/testing/pytest/plugins/skips.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/testing/pytest/plugins/spacing.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/text/delimit.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish/text/indent.py +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish.egg-info/dependency_links.txt +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/omlish.egg-info/top_level.txt +0 -0
- {omlish-0.0.0.dev0 → omlish-0.0.0.dev2}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
global-exclude **/conftest.py
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: omlish
|
|
3
|
+
Version: 0.0.0.dev2
|
|
4
|
+
Summary: omlish
|
|
5
|
+
Author: wrmsr
|
|
6
|
+
License: BSD-3-Clause
|
|
7
|
+
Project-URL: source, https://github.com/wrmsr/omlish
|
|
8
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
9
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.12
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Provides-Extra: async
|
|
15
|
+
Requires-Dist: anyio; extra == "async"
|
|
16
|
+
Provides-Extra: http
|
|
17
|
+
Requires-Dist: httpx; extra == "http"
|
|
18
|
+
Provides-Extra: sql
|
|
19
|
+
Requires-Dist: sqlalchemy; extra == "sql"
|
|
20
|
+
Provides-Extra: wrapt
|
|
21
|
+
Requires-Dist: wrapt; extra == "wrapt"
|
|
22
|
+
Provides-Extra: yaml
|
|
23
|
+
Requires-Dist: pyyaml; extra == "yaml"
|
|
24
|
+
Provides-Extra: server
|
|
25
|
+
Requires-Dist: h11; extra == "server"
|
|
26
|
+
Requires-Dist: h2; extra == "server"
|
|
27
|
+
Requires-Dist: priority; extra == "server"
|
|
28
|
+
Requires-Dist: wsproto; extra == "server"
|
|
29
|
+
Provides-Extra: test
|
|
30
|
+
Requires-Dist: pytest; extra == "test"
|
|
@@ -48,7 +48,7 @@ ArgumentParser = argparse.ArgumentParser
|
|
|
48
48
|
class Arg:
|
|
49
49
|
args: ta.Sequence[ta.Any]
|
|
50
50
|
kwargs: ta.Mapping[str, ta.Any]
|
|
51
|
-
dest:
|
|
51
|
+
dest: str | None = None
|
|
52
52
|
|
|
53
53
|
def __get__(self, instance, owner=None):
|
|
54
54
|
if instance is None:
|
|
@@ -92,8 +92,8 @@ class Command:
|
|
|
92
92
|
|
|
93
93
|
def command(
|
|
94
94
|
*args: Arg,
|
|
95
|
-
name:
|
|
96
|
-
parent:
|
|
95
|
+
name: str | None = None,
|
|
96
|
+
parent: Command | None = None,
|
|
97
97
|
) -> ta.Any: # ta.Callable[[CommandFn], Command]: # FIXME
|
|
98
98
|
for arg in args:
|
|
99
99
|
check.isinstance(arg, Arg)
|
|
@@ -192,7 +192,7 @@ class _CliMeta(type):
|
|
|
192
192
|
|
|
193
193
|
class Cli(metaclass=_CliMeta):
|
|
194
194
|
|
|
195
|
-
def __init__(self, argv: ta.
|
|
195
|
+
def __init__(self, argv: ta.Sequence[str] | None = None) -> None:
|
|
196
196
|
super().__init__()
|
|
197
197
|
|
|
198
198
|
self._argv = argv if argv is not None else sys.argv[1:]
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
from .asyncs import ( # noqa
|
|
2
|
-
AsyncTimeoutException,
|
|
3
|
-
FutureException,
|
|
4
|
-
ImmediateExecutor,
|
|
5
2
|
SyncableIterable,
|
|
6
3
|
async_list,
|
|
7
|
-
await_dependent_futures,
|
|
8
|
-
await_futures,
|
|
9
4
|
sync_await,
|
|
10
5
|
sync_list,
|
|
11
6
|
syncable_iterable,
|
|
12
7
|
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
from .futures import ( # noqa
|
|
11
|
+
FutureException,
|
|
12
|
+
FutureTimeoutException,
|
|
13
|
+
ImmediateExecutor,
|
|
14
|
+
new_thread_or_immediate_executor,
|
|
15
|
+
wait_dependent_futures,
|
|
16
|
+
wait_futures,
|
|
17
|
+
)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""
|
|
2
|
+
lookit:
|
|
3
|
+
- https://github.com/davidbrochart/sqlite-anyio/blob/a3ba4c6ef0535b14a5a60071fcd6ed565a514963/sqlite_anyio/sqlite.py
|
|
4
|
+
- https://github.com/rafalkrupinski/ratelimit-anyio/blob/2910a8a3d6fa54ed17ee6ba457686c9f7a4c4beb/src/ratelimit_anyio/__init__.py
|
|
5
|
+
- https://github.com/nekitdev/async-extensions/tree/main/async_extensions
|
|
6
|
+
- https://github.com/kinnay/anynet/tree/master/anynet
|
|
7
|
+
- https://github.com/M-o-a-T/asyncscope
|
|
8
|
+
- https://github.com/M-o-a-T/aevent
|
|
9
|
+
- https://github.com/florimondmanca/aiometer
|
|
10
|
+
- https://github.com/sanitizers/octomachinery/blob/b36c3d3d49da813ac46e361424132955a4e99ac8/octomachinery/utils/asynctools.py
|
|
11
|
+
""" # noqa
|
|
12
|
+
import typing as ta
|
|
13
|
+
|
|
14
|
+
import anyio.streams.memory
|
|
15
|
+
import anyio.streams.stapled
|
|
16
|
+
|
|
17
|
+
from .. import check
|
|
18
|
+
from .. import lang
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
T = ta.TypeVar('T')
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
async def anyio_eof_to_empty(fn: ta.Callable[..., ta.Awaitable[T]], *args: ta.Any, **kwargs: ta.Any) -> T | bytes:
|
|
25
|
+
try:
|
|
26
|
+
return await fn(*args, **kwargs)
|
|
27
|
+
except anyio.EndOfStream:
|
|
28
|
+
return b''
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def split_memory_object_streams(
|
|
32
|
+
*args: anyio.create_memory_object_stream[T],
|
|
33
|
+
) -> tuple[
|
|
34
|
+
anyio.streams.memory.MemoryObjectSendStream[T],
|
|
35
|
+
anyio.streams.memory.MemoryObjectReceiveStream[T],
|
|
36
|
+
]:
|
|
37
|
+
[tup] = args
|
|
38
|
+
return tup
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# FIXME: https://github.com/python/mypy/issues/15238
|
|
42
|
+
# def create_memory_object_stream[T](max_buffer_size: float = 0) -> tuple[
|
|
43
|
+
# anyio.streams.memory.MemoryObjectSendStream[T],
|
|
44
|
+
# anyio.streams.memory.MemoryObjectReceiveStream[T],
|
|
45
|
+
# ]:
|
|
46
|
+
# return anyio.create_memory_object_stream[T](max_buffer_size)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def staple_memory_object_stream(
|
|
50
|
+
*args: anyio.create_memory_object_stream[T],
|
|
51
|
+
) -> anyio.streams.stapled.StapledObjectStream[T]:
|
|
52
|
+
send, receive = args
|
|
53
|
+
return anyio.streams.stapled.StapledObjectStream(
|
|
54
|
+
check.isinstance(send, anyio.streams.memory.MemoryObjectSendStream), # type: ignore
|
|
55
|
+
check.isinstance(receive, anyio.streams.memory.MemoryObjectReceiveStream), # type: ignore
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# FIXME: https://github.com/python/mypy/issues/15238
|
|
60
|
+
# def staple_memory_object_stream2[T](max_buffer_size: float = 0) -> anyio.streams.stapled.StapledObjectStream[T]:
|
|
61
|
+
# send, receive = anyio.create_memory_object_stream[T](max_buffer_size)
|
|
62
|
+
# return anyio.streams.stapled.StapledObjectStream(
|
|
63
|
+
# check.isinstance(send, anyio.streams.memory.MemoryObjectSendStream), # type: ignore
|
|
64
|
+
# check.isinstance(receive, anyio.streams.memory.MemoryObjectReceiveStream), # type: ignore
|
|
65
|
+
# )
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
async def gather(*fns: ta.Callable[..., ta.Awaitable[T]], take_first: bool = False) -> list[lang.Maybe[T]]:
|
|
69
|
+
results: list[lang.Maybe[T]] = [lang.empty()] * len(fns)
|
|
70
|
+
|
|
71
|
+
async def inner(fn, i):
|
|
72
|
+
results[i] = lang.just(await fn())
|
|
73
|
+
if take_first:
|
|
74
|
+
tg.cancel_scope.cancel()
|
|
75
|
+
|
|
76
|
+
async with anyio.create_task_group() as tg:
|
|
77
|
+
for i, fn in enumerate(fns):
|
|
78
|
+
tg.start_soon(inner, fn, i)
|
|
79
|
+
|
|
80
|
+
return results
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
async def first(*fns: ta.Callable[..., ta.Awaitable[T]], **kwargs: ta.Any) -> list[lang.Maybe[T]]:
|
|
84
|
+
return await gather(*fns, take_first=True, **kwargs)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""
|
|
2
|
+
TODO:
|
|
3
|
+
- async<->sync greeenlet bridge
|
|
4
|
+
In [5]: %timeit greenlet.greenlet(f).switch()
|
|
5
|
+
517 ns ± 13.2 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
|
|
6
|
+
- injected io provider - sync vs greenlet aio trampolined
|
|
7
|
+
- push/pull bridge?
|
|
8
|
+
|
|
9
|
+
https://github.com/sqlalchemy/sqlalchemy/blob/1e75c189da721395bc8c2d899c722a5b9a170404/lib/sqlalchemy/util/_concurrency_py3k.py#L83
|
|
10
|
+
"""
|
|
11
|
+
import contextlib
|
|
12
|
+
import functools
|
|
13
|
+
import typing as ta
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
T = ta.TypeVar('T')
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def sync_await(fn: ta.Callable[..., T], *args, **kwargs) -> T:
|
|
20
|
+
ret: ta.Any
|
|
21
|
+
ret = missing = object()
|
|
22
|
+
|
|
23
|
+
async def gate():
|
|
24
|
+
nonlocal ret
|
|
25
|
+
ret = await fn(*args, **kwargs) # type: ignore
|
|
26
|
+
|
|
27
|
+
cr = gate()
|
|
28
|
+
with contextlib.closing(cr):
|
|
29
|
+
try:
|
|
30
|
+
cr.send(None)
|
|
31
|
+
except StopIteration:
|
|
32
|
+
pass
|
|
33
|
+
if ret is missing or cr.cr_await is not None or cr.cr_running:
|
|
34
|
+
raise TypeError('Not terminated')
|
|
35
|
+
|
|
36
|
+
return ta.cast(T, ret)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def sync_list(fn: ta.Callable[..., ta.AsyncIterator[T]], *args, **kwargs) -> list[T]:
|
|
40
|
+
lst = None
|
|
41
|
+
|
|
42
|
+
async def inner():
|
|
43
|
+
nonlocal lst
|
|
44
|
+
lst = [v async for v in fn(*args, **kwargs)]
|
|
45
|
+
|
|
46
|
+
sync_await(inner)
|
|
47
|
+
if not isinstance(lst, list):
|
|
48
|
+
raise TypeError(lst)
|
|
49
|
+
return lst
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
async def async_list(fn: ta.Callable[..., ta.AsyncIterator[T]], *args, **kwargs) -> list[T]:
|
|
53
|
+
return [v async for v in fn(*args, **kwargs)]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class SyncableIterable(ta.Generic[T]):
|
|
57
|
+
|
|
58
|
+
def __init__(self, obj) -> None:
|
|
59
|
+
super().__init__()
|
|
60
|
+
self._obj = obj
|
|
61
|
+
|
|
62
|
+
def __iter__(self) -> ta.Iterator[T]:
|
|
63
|
+
async def inner():
|
|
64
|
+
async for i in self._obj:
|
|
65
|
+
yield i
|
|
66
|
+
return iter(sync_list(inner))
|
|
67
|
+
|
|
68
|
+
def __aiter__(self) -> ta.AsyncIterator[T]:
|
|
69
|
+
return self._obj.__aiter__()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def syncable_iterable(fn: ta.Callable[..., ta.AsyncIterator[T]]) -> ta.Callable[..., SyncableIterable[T]]:
|
|
73
|
+
@functools.wraps(fn)
|
|
74
|
+
def inner(*args, **kwargs):
|
|
75
|
+
return SyncableIterable(fn(*args, **kwargs))
|
|
76
|
+
return inner
|
|
@@ -1,109 +1,18 @@
|
|
|
1
|
-
"""
|
|
2
|
-
TODO:
|
|
3
|
-
- async<->sync greeenlet bridge
|
|
4
|
-
In [5]: %timeit greenlet.greenlet(f).switch()
|
|
5
|
-
517 ns ± 13.2 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
|
|
6
|
-
- injected io provider - sync vs greenlet aio trampolined
|
|
7
|
-
- push/pull bridge?
|
|
8
|
-
|
|
9
|
-
https://github.com/sqlalchemy/sqlalchemy/blob/1e75c189da721395bc8c2d899c722a5b9a170404/lib/sqlalchemy/util/_concurrency_py3k.py#L83
|
|
10
|
-
"""
|
|
11
1
|
import concurrent.futures as cf
|
|
12
2
|
import contextlib
|
|
13
|
-
import functools
|
|
14
3
|
import time
|
|
15
4
|
import typing as ta
|
|
16
5
|
|
|
17
6
|
|
|
18
7
|
T = ta.TypeVar('T')
|
|
19
|
-
CallableT = ta.TypeVar('CallableT', bound=ta.Callable)
|
|
20
8
|
|
|
21
9
|
|
|
22
|
-
|
|
23
|
-
ret: ta.Any
|
|
24
|
-
ret = missing = object()
|
|
25
|
-
|
|
26
|
-
async def gate():
|
|
27
|
-
nonlocal ret
|
|
28
|
-
ret = await fn(*args, **kwargs) # type: ignore
|
|
29
|
-
|
|
30
|
-
cr = gate()
|
|
31
|
-
with contextlib.closing(cr):
|
|
32
|
-
try:
|
|
33
|
-
cr.send(None)
|
|
34
|
-
except StopIteration:
|
|
35
|
-
pass
|
|
36
|
-
if ret is missing or cr.cr_await is not None or cr.cr_running:
|
|
37
|
-
raise TypeError('Not terminated')
|
|
38
|
-
|
|
39
|
-
return ta.cast(T, ret)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def sync_list(fn: ta.Callable[..., ta.AsyncIterator[T]], *args, **kwargs) -> list[T]:
|
|
43
|
-
lst = None
|
|
44
|
-
|
|
45
|
-
async def inner():
|
|
46
|
-
nonlocal lst
|
|
47
|
-
lst = [v async for v in fn(*args, **kwargs)]
|
|
48
|
-
|
|
49
|
-
sync_await(inner)
|
|
50
|
-
if not isinstance(lst, list):
|
|
51
|
-
raise TypeError(lst)
|
|
52
|
-
return lst
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
async def async_list(fn: ta.Callable[..., ta.AsyncIterator[T]], *args, **kwargs) -> list[T]:
|
|
56
|
-
return [v async for v in fn(*args, **kwargs)]
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
class SyncableIterable(ta.Generic[T]):
|
|
60
|
-
|
|
61
|
-
def __init__(self, obj) -> None:
|
|
62
|
-
super().__init__()
|
|
63
|
-
self._obj = obj
|
|
64
|
-
|
|
65
|
-
def __iter__(self) -> ta.Iterator[T]:
|
|
66
|
-
async def inner():
|
|
67
|
-
async for i in self._obj:
|
|
68
|
-
yield i
|
|
69
|
-
return iter(sync_list(inner))
|
|
70
|
-
|
|
71
|
-
def __aiter__(self) -> ta.AsyncIterator[T]:
|
|
72
|
-
return self._obj.__aiter__()
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def syncable_iterable(fn: ta.Callable[..., ta.AsyncIterator[T]]) -> ta.Callable[..., SyncableIterable[T]]:
|
|
76
|
-
@functools.wraps(fn)
|
|
77
|
-
def inner(*args, **kwargs):
|
|
78
|
-
return SyncableIterable(fn(*args, **kwargs))
|
|
79
|
-
return inner
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
class ImmediateExecutor(cf.Executor):
|
|
83
|
-
|
|
84
|
-
def __init__(self, *, immediate_exceptions: bool = False) -> None:
|
|
85
|
-
super().__init__()
|
|
86
|
-
self._immediate_exceptions = immediate_exceptions
|
|
87
|
-
|
|
88
|
-
def submit(self, fn, *args, **kwargs):
|
|
89
|
-
future: ta.Any = cf.Future()
|
|
90
|
-
try:
|
|
91
|
-
result = fn(*args, **kwargs)
|
|
92
|
-
future.set_result(result)
|
|
93
|
-
except Exception as e:
|
|
94
|
-
if self._immediate_exceptions:
|
|
95
|
-
raise
|
|
96
|
-
future.set_exception(e)
|
|
97
|
-
return future
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
class AsyncTimeoutException(Exception):
|
|
101
|
-
pass
|
|
10
|
+
##
|
|
102
11
|
|
|
103
12
|
|
|
104
13
|
class FutureException(Exception, ta.Generic[T]):
|
|
105
14
|
|
|
106
|
-
def __init__(self, future: cf.Future, target:
|
|
15
|
+
def __init__(self, future: cf.Future, target: T | None = None) -> None:
|
|
107
16
|
super().__init__()
|
|
108
17
|
|
|
109
18
|
self._future = future
|
|
@@ -114,7 +23,7 @@ class FutureException(Exception, ta.Generic[T]):
|
|
|
114
23
|
return self._future
|
|
115
24
|
|
|
116
25
|
@property
|
|
117
|
-
def target(self) ->
|
|
26
|
+
def target(self) -> T | None:
|
|
118
27
|
return self._target
|
|
119
28
|
|
|
120
29
|
def __repr__(self) -> str:
|
|
@@ -128,11 +37,15 @@ class FutureException(Exception, ta.Generic[T]):
|
|
|
128
37
|
__str__ = __repr__
|
|
129
38
|
|
|
130
39
|
|
|
131
|
-
|
|
40
|
+
class FutureTimeoutException(Exception):
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def wait_futures(
|
|
132
45
|
futures: ta.Sequence[cf.Future],
|
|
133
46
|
*,
|
|
134
|
-
timeout_s:
|
|
135
|
-
tick_interval_s:
|
|
47
|
+
timeout_s: float = 60,
|
|
48
|
+
tick_interval_s: float = .5,
|
|
136
49
|
tick_fn: ta.Callable[..., bool] = lambda: True,
|
|
137
50
|
raise_exceptions: bool = False,
|
|
138
51
|
cancel_on_exception: bool = False,
|
|
@@ -155,18 +68,18 @@ def await_futures(
|
|
|
155
68
|
return True
|
|
156
69
|
|
|
157
70
|
if time.time() >= (start + timeout_s):
|
|
158
|
-
raise
|
|
71
|
+
raise FutureTimeoutException
|
|
159
72
|
time.sleep(tick_interval_s)
|
|
160
73
|
|
|
161
74
|
return False
|
|
162
75
|
|
|
163
76
|
|
|
164
|
-
def
|
|
77
|
+
def wait_dependent_futures(
|
|
165
78
|
executor: cf.Executor,
|
|
166
79
|
dependency_sets_by_fn: ta.Mapping[ta.Callable, ta.AbstractSet[ta.Callable]],
|
|
167
80
|
*,
|
|
168
|
-
timeout_s:
|
|
169
|
-
tick_interval_s:
|
|
81
|
+
timeout_s: float = 60,
|
|
82
|
+
tick_interval_s: float = .5,
|
|
170
83
|
tick_fn: ta.Callable[..., bool] = lambda: True,
|
|
171
84
|
) -> ta.Mapping[ta.Callable, cf.Future]:
|
|
172
85
|
for fn, deps in dependency_sets_by_fn.items():
|
|
@@ -215,7 +128,7 @@ def await_dependent_futures(
|
|
|
215
128
|
|
|
216
129
|
if time.time() >= (start + timeout_s):
|
|
217
130
|
cancel()
|
|
218
|
-
raise
|
|
131
|
+
raise FutureTimeoutException
|
|
219
132
|
|
|
220
133
|
remaining_fns = {fn: deps for fn, deps in remaining_dep_sets_by_fn.items() if deps}
|
|
221
134
|
if remaining_fns:
|
|
@@ -223,3 +136,44 @@ def await_dependent_futures(
|
|
|
223
136
|
|
|
224
137
|
futs_by_fn = {fn: fut for fut, fn in fns_by_fut.items()}
|
|
225
138
|
return futs_by_fn
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
##
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
class ImmediateExecutor(cf.Executor):
|
|
145
|
+
|
|
146
|
+
def __init__(self, *, immediate_exceptions: bool = False) -> None:
|
|
147
|
+
super().__init__()
|
|
148
|
+
self._immediate_exceptions = immediate_exceptions
|
|
149
|
+
|
|
150
|
+
def submit(self, fn, *args, **kwargs):
|
|
151
|
+
future: ta.Any = cf.Future()
|
|
152
|
+
try:
|
|
153
|
+
result = fn(*args, **kwargs)
|
|
154
|
+
future.set_result(result)
|
|
155
|
+
except Exception as e:
|
|
156
|
+
if self._immediate_exceptions:
|
|
157
|
+
raise
|
|
158
|
+
future.set_exception(e)
|
|
159
|
+
return future
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
@contextlib.contextmanager
|
|
163
|
+
def new_thread_or_immediate_executor(
|
|
164
|
+
max_workers: int | None = None,
|
|
165
|
+
*,
|
|
166
|
+
immediate_exceptions: bool = False,
|
|
167
|
+
thread_name_prefix: str = '',
|
|
168
|
+
**kwargs: ta.Any,
|
|
169
|
+
) -> ta.Generator[cf.Executor, None, None]:
|
|
170
|
+
if max_workers == 0:
|
|
171
|
+
yield ImmediateExecutor(
|
|
172
|
+
immediate_exceptions=immediate_exceptions,
|
|
173
|
+
)
|
|
174
|
+
else:
|
|
175
|
+
with cf.ThreadPoolExecutor(
|
|
176
|
+
thread_name_prefix=thread_name_prefix,
|
|
177
|
+
**kwargs,
|
|
178
|
+
) as exe:
|
|
179
|
+
yield exe
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""
|
|
2
|
+
lookit:
|
|
3
|
+
- https://github.com/oremanj/trio-monitor
|
|
4
|
+
- https://github.com/python-trio/trio-monitor/tree/master
|
|
5
|
+
- https://github.com/python-trio/triopg
|
|
6
|
+
- https://github.com/python-trio/trio-mysql
|
|
7
|
+
- https://github.com/goodboy/tractor
|
|
8
|
+
- https://github.com/groove-x/trio-util
|
|
9
|
+
- https://github.com/oremanj/tricycle/tree/master
|
|
10
|
+
- https://github.com/linkdd/triotp
|
|
11
|
+
"""
|
|
@@ -49,7 +49,7 @@ def merge(seqs: ta.MutableSequence[list[T]]) -> list[T]:
|
|
|
49
49
|
"""
|
|
50
50
|
|
|
51
51
|
result: list[T] = []
|
|
52
|
-
candidate:
|
|
52
|
+
candidate: T | None = None
|
|
53
53
|
while True:
|
|
54
54
|
seqs = [s for s in seqs if s] # purge empty sequences
|
|
55
55
|
if not seqs:
|
|
@@ -73,7 +73,7 @@ def merge(seqs: ta.MutableSequence[list[T]]) -> list[T]:
|
|
|
73
73
|
|
|
74
74
|
def mro(
|
|
75
75
|
cls: T,
|
|
76
|
-
abcs: ta.
|
|
76
|
+
abcs: ta.Sequence[T] | None = None,
|
|
77
77
|
*,
|
|
78
78
|
get_bases: ta.Callable[[T], ta.Sequence[T]] = operator.attrgetter('__bases__'),
|
|
79
79
|
is_subclass: ta.Callable[[T, T], bool] = issubclass, # type: ignore
|
|
@@ -115,7 +115,7 @@ def mro(
|
|
|
115
115
|
return merge(
|
|
116
116
|
[[cls]] +
|
|
117
117
|
explicit_c3_mros + abstract_c3_mros + other_c3_mros +
|
|
118
|
-
[explicit_bases] + [abstract_bases] + [other_bases]
|
|
118
|
+
[explicit_bases] + [abstract_bases] + [other_bases],
|
|
119
119
|
)
|
|
120
120
|
|
|
121
121
|
|
|
@@ -123,7 +123,7 @@ def compose_mro(
|
|
|
123
123
|
cls: T,
|
|
124
124
|
types: ta.Iterable[T],
|
|
125
125
|
*,
|
|
126
|
-
get_mro: ta.Callable[[T], ta.
|
|
126
|
+
get_mro: ta.Callable[[T], ta.Sequence[T] | None] = operator.attrgetter('__mro__'),
|
|
127
127
|
get_bases: ta.Callable[[T], ta.Sequence[T]] = operator.attrgetter('__bases__'),
|
|
128
128
|
is_subclass: ta.Callable[[T, T], bool] = issubclass, # type: ignore
|
|
129
129
|
get_subclasses: ta.Callable[[T], ta.Iterable[T]] = operator.methodcaller('__subclasses__'),
|
|
@@ -9,7 +9,7 @@ import typing as ta
|
|
|
9
9
|
T = ta.TypeVar('T')
|
|
10
10
|
SizedT = ta.TypeVar('SizedT', bound=ta.Sized)
|
|
11
11
|
|
|
12
|
-
Message = ta.Union[str, ta.Callable[...,
|
|
12
|
+
Message = ta.Union[str, ta.Callable[..., str | None], None]
|
|
13
13
|
|
|
14
14
|
_NONE_TYPE = type(None)
|
|
15
15
|
|
|
@@ -33,7 +33,7 @@ def _raise(
|
|
|
33
33
|
default_message: str,
|
|
34
34
|
message: Message,
|
|
35
35
|
*args: ta.Any,
|
|
36
|
-
**kwargs: ta.Any
|
|
36
|
+
**kwargs: ta.Any,
|
|
37
37
|
) -> ta.NoReturn:
|
|
38
38
|
if _callable(message):
|
|
39
39
|
message = ta.cast(ta.Callable, message)(*args, **kwargs)
|
|
@@ -64,7 +64,7 @@ def isinstance(v: ta.Any, spec: ta.Union[type[T], tuple], msg: Message = None) -
|
|
|
64
64
|
return v
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
def of_isinstance(spec:
|
|
67
|
+
def of_isinstance(spec: type[T] | tuple, msg: Message = None) -> ta.Callable[[ta.Any], T]:
|
|
68
68
|
def inner(v):
|
|
69
69
|
return isinstance(v, _unpack_isinstance_spec(spec), msg)
|
|
70
70
|
|
|
@@ -155,7 +155,7 @@ def single(obj: ta.Iterable[T], message: Message = None) -> T:
|
|
|
155
155
|
return value
|
|
156
156
|
|
|
157
157
|
|
|
158
|
-
def optional_single(obj: ta.Iterable[T], message: Message = None) ->
|
|
158
|
+
def optional_single(obj: ta.Iterable[T], message: Message = None) -> T | None:
|
|
159
159
|
it = iter(obj)
|
|
160
160
|
try:
|
|
161
161
|
value = next(it)
|
|
@@ -176,7 +176,7 @@ def none(v: ta.Any, msg: Message = None) -> None:
|
|
|
176
176
|
_raise(ValueError, 'Must be None', msg, v)
|
|
177
177
|
|
|
178
178
|
|
|
179
|
-
def not_none(v:
|
|
179
|
+
def not_none(v: T | None, msg: Message = None) -> T:
|
|
180
180
|
if v is None:
|
|
181
181
|
_raise(ValueError, 'Must not be None', msg, v)
|
|
182
182
|
return v
|
|
@@ -212,7 +212,7 @@ def callable(v: T, msg: Message = None) -> T:
|
|
|
212
212
|
return v # type: ignore
|
|
213
213
|
|
|
214
214
|
|
|
215
|
-
def non_empty_str(v:
|
|
215
|
+
def non_empty_str(v: str | None, msg: Message = None) -> str:
|
|
216
216
|
if not _isinstance(v, str) or not v:
|
|
217
217
|
_raise(ValueError, 'Must be non-empty str', msg, v)
|
|
218
218
|
return v
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
from .coerce import ( # noqa
|
|
2
|
+
abs_set,
|
|
3
|
+
abs_set_of,
|
|
4
|
+
abs_set_of_or_none,
|
|
5
|
+
abs_set_or_none,
|
|
6
|
+
frozenset_,
|
|
7
|
+
frozenset_of,
|
|
8
|
+
frozenset_of_or_none,
|
|
9
|
+
frozenset_or_none,
|
|
10
|
+
map,
|
|
11
|
+
map_of,
|
|
12
|
+
map_of_or_none,
|
|
13
|
+
map_or_none,
|
|
14
|
+
opt_abs_set,
|
|
15
|
+
opt_abs_set_of,
|
|
16
|
+
opt_frozenset,
|
|
17
|
+
opt_frozenset_of,
|
|
18
|
+
opt_map,
|
|
19
|
+
opt_map_of,
|
|
20
|
+
opt_seq,
|
|
21
|
+
opt_seq_of,
|
|
22
|
+
seq,
|
|
23
|
+
seq_of,
|
|
24
|
+
seq_of_or_none,
|
|
25
|
+
seq_or_none,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
from .frozen import ( # noqa
|
|
29
|
+
Frozen,
|
|
30
|
+
FrozenDict,
|
|
31
|
+
FrozenList,
|
|
32
|
+
frozendict,
|
|
33
|
+
frozenlist,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
from .identity import ( # noqa
|
|
37
|
+
IdentityKeyDict,
|
|
38
|
+
IdentitySet,
|
|
39
|
+
IdentityWrapper,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
from .indexed import ( # noqa
|
|
43
|
+
IndexedSeq,
|
|
44
|
+
IndexedSetSeq,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
from .mappings import ( # noqa
|
|
48
|
+
MissingDict,
|
|
49
|
+
TypeMap,
|
|
50
|
+
TypeMultiMap,
|
|
51
|
+
guarded_map_update,
|
|
52
|
+
multikey_dict,
|
|
53
|
+
yield_dict_init,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
from .ordered import ( # noqa
|
|
57
|
+
OrderedFrozenSet,
|
|
58
|
+
OrderedSet,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
from .persistent import ( # noqa
|
|
62
|
+
PersistentMap,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
from .skiplist import ( # noqa
|
|
66
|
+
SkipList,
|
|
67
|
+
SkipListDict,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
from .sorted import ( # noqa
|
|
71
|
+
SortedCollection,
|
|
72
|
+
SortedListDict,
|
|
73
|
+
SortedMapping,
|
|
74
|
+
SortedMutableMapping,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
from .treapmap import ( # noqa
|
|
78
|
+
new_treap_map,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
from .unmodifiable import ( # noqa
|
|
82
|
+
Unmodifiable,
|
|
83
|
+
UnmodifiableMapping,
|
|
84
|
+
UnmodifiableSequence,
|
|
85
|
+
UnmodifiableSet,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
from .utils import ( # noqa
|
|
89
|
+
all_equal,
|
|
90
|
+
all_not_equal,
|
|
91
|
+
indexes,
|
|
92
|
+
key_cmp,
|
|
93
|
+
mut_toposort,
|
|
94
|
+
partition,
|
|
95
|
+
toposort,
|
|
96
|
+
unique,
|
|
97
|
+
unique_dict,
|
|
98
|
+
)
|