forked from globus/globus-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
44 lines (39 loc) · 1.23 KB
/
__init__.py
File metadata and controls
44 lines (39 loc) · 1.23 KB
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
import importlib
import sys
import typing as t
__all__ = (
"BookmarkCreateDocument",
"BookmarkUpdateDocument",
"TransferClientV2",
"TunnelCreateDocument",
"TunnelUpdateDocument",
)
# imports from `globus_sdk.experimental.transfer_v2` are done lazily to ensure
# that we do not eagerly import `requests` when attempting to use SDK
# components which do not need it
if t.TYPE_CHECKING:
from .transfer_v2 import (
BookmarkCreateDocument,
BookmarkUpdateDocument,
TransferClientV2,
TunnelCreateDocument,
TunnelUpdateDocument,
)
else:
_LAZY_IMPORT_TABLE = {
"transfer_v2": {
"BookmarkCreateDocument",
"BookmarkUpdateDocument",
"TransferClientV2",
"TunnelCreateDocument",
"TunnelUpdateDocument",
}
}
def __getattr__(name: str) -> t.Any:
for modname, items in _LAZY_IMPORT_TABLE.items():
if name in items:
mod = importlib.import_module("." + modname, __name__)
value = getattr(mod, name)
setattr(sys.modules[__name__], name, value)
return value
raise AttributeError(f"module {__name__} has no attribute {name}")