-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy path__init__.py
More file actions
34 lines (25 loc) · 895 Bytes
/
__init__.py
File metadata and controls
34 lines (25 loc) · 895 Bytes
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
import importlib
import importlib.util
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
def _load_native_module():
for module_name in ("_taosws", "taosws"):
full_name = f"{__name__}.{module_name}"
if importlib.util.find_spec(full_name) is None:
continue
return importlib.import_module(full_name)
raise ImportError(
"Failed to import native extension 'taosws._taosws' or 'taosws.taosws'. "
"Ensure taos-ws-py is built and installed correctly."
)
_native = _load_native_module()
if hasattr(_native, "__all__"):
for name in _native.__all__:
globals()[name] = getattr(_native, name)
else:
for name in dir(_native):
if not name.startswith("_"):
globals()[name] = getattr(_native, name)
__doc__ = _native.__doc__
if hasattr(_native, "__all__"):
__all__ = _native.__all__