-
Notifications
You must be signed in to change notification settings - Fork 143
Expand file tree
/
Copy path__init__.py
More file actions
59 lines (50 loc) · 1.96 KB
/
__init__.py
File metadata and controls
59 lines (50 loc) · 1.96 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# This file was auto-generated by Fern from our API Definition.
# isort: skip_file
import typing
from importlib import import_module
if typing.TYPE_CHECKING:
from .bad_request_error import BadRequestError
from .conflict_error import ConflictError
from .forbidden_error import ForbiddenError
from .internal_server_error import InternalServerError
from .not_found_error import NotFoundError
from .too_many_requests_error import TooManyRequestsError
from .unauthorized_error import UnauthorizedError
from .unprocessable_entity_error import UnprocessableEntityError
_dynamic_imports: typing.Dict[str, str] = {
"BadRequestError": ".bad_request_error",
"ConflictError": ".conflict_error",
"ForbiddenError": ".forbidden_error",
"InternalServerError": ".internal_server_error",
"NotFoundError": ".not_found_error",
"TooManyRequestsError": ".too_many_requests_error",
"UnauthorizedError": ".unauthorized_error",
"UnprocessableEntityError": ".unprocessable_entity_error",
}
def __getattr__(attr_name: str) -> typing.Any:
module_name = _dynamic_imports.get(attr_name)
if module_name is None:
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
try:
module = import_module(module_name, __package__)
if module_name == f".{attr_name}":
return module
else:
return getattr(module, attr_name)
except ImportError as e:
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
except AttributeError as e:
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
def __dir__():
lazy_attrs = list(_dynamic_imports.keys())
return sorted(lazy_attrs)
__all__ = [
"BadRequestError",
"ConflictError",
"ForbiddenError",
"InternalServerError",
"NotFoundError",
"TooManyRequestsError",
"UnauthorizedError",
"UnprocessableEntityError",
]