/
__init__.py
53 lines (40 loc) · 1.11 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -*- coding: utf-8 -*-
"""
serialize
~~~~~~~~~
:copyright: (c) 2016 by Hernan E. Grecco.
:license: BSD, see LICENSE for more details.
"""
from importlib import import_module
try:
from importlib.metadata import version
except ImportError:
# Backport for Python < 3.8
from importlib_metadata import version
try: # pragma: no cover
__version__ = version("serialize")
except Exception: # pragma: no cover
# we seem to have a local copy not installed without setuptools
# so the reported version will be unknown
__version__ = "unknown"
# Modules that help serialize use other packages.
_MODULES = (
"bson",
"dill",
"json",
"msgpack",
"phpserialize",
"pickle",
"serpent",
"yaml",
"yaml_legacy",
)
for name in _MODULES:
try:
import_module("." + name, "serialize")
except Exception:
pass
# Others to consider in the future for specialized serialization:
# CSV, pandas.DATAFRAMES, hickle, hdf5
from .all import dump, dumps, load, loads, register_class # noqa: E402
__all__ = ["dump", "dumps", "load", "loads", "register_class"]