Source code for asyncutils
1# Copyright © 2026 Jonathan Dung. All rights reserved.
2# SPDX-License-Identifier: MIT
3from sys import implementation as I, modules as M
4match I.name:
5 case 'cpython':
6 if I.version < (3, 12): raise ImportError('asyncutils: CPython 3.12 or above required')
7 case 'graalpy':
8 if I.version[0] < 25: raise ImportError('asyncutils: GraalPy 25 (Python 3.12) or above required') # noqa: PLR2004
9 case s: raise ImportError(f'asyncutils is neither tested in {s} nor currently planned to be')
10from time import monotonic as T
[docs]
11def time_since_boot(t=T(), T=T): return round(T()-t, 7)*1000 # noqa: B008
12M['asyncutils._internal.log'] = __import__('logging').getLogger('asyncutils') # ty: ignore[invalid-assignment]
13def __getattr__(n, /, _=globals()):
14 from asyncutils._internal import initialize as I; _.update(__getattr__=I.Module, __all__=I.a, submodules_map=I.s, __dir__=lambda _=I.S: _)
15 try: return _[n]
16 except KeyError: return I.Module(n) # pragma: no cover
17from asyncutils.version import VersionInfo as V
18time_since_boot.__text_signature__, __hexversion__, console_preloaded_submodules = '()', int(__version__ := V('0.9.11')), (preloaded_submodules := frozenset(('constants', 'context', 'cli', 'exceptions', 'version'))).union(('base', 'config', 'console')) # ty: ignore[unresolved-attribute]
19del V, I, T, M