Coverage for zanj/consts.py: 71%

1"""Constants and re-exports from muutils with version compatibility."""

2

3 from __future__ import annotations

4

5# Items that exist in muutils.json_serialize.util across all versions

6 from muutils.json_serialize.util import (

7 JSONdict,

8 JSONitem,

9 MonoTuple,

10 safe_getsource,

11 string_as_lines,

12)

13

14# _FORMAT_KEY and _REF_KEY moved from .util to .types in muutils >= 0.9

15 try:

16 from muutils.json_serialize.types import _FORMAT_KEY, _REF_KEY # type: ignore[import-not-found]

17 except ImportError:

18 # fallback for muutils < 0.9 where these lived in .util; mypy can't resolve this across try/except

19 from muutils.json_serialize.util import _FORMAT_KEY, _REF_KEY # type: ignore[import-not-found, attr-defined, no-redef]

20

21 __all__ = [

22 "JSONdict",

23 "JSONitem",

24 "MonoTuple",

25 "_FORMAT_KEY",

26 "_REF_KEY",

27 "safe_getsource",

28 "string_as_lines",

29]