mistralai 1.9.7__py3-none-any.whl → 1.9.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mistralai/_version.py +2 -2
- mistralai/embeddings.py +6 -0
- mistralai/models/__init__.py +11 -0
- mistralai/models/apiendpoint.py +5 -0
- mistralai/models/embeddingrequest.py +5 -1
- mistralai/models/encodingformat.py +7 -0
- mistralai/models/systemmessage.py +7 -3
- mistralai/models/systemmessagecontentchunks.py +21 -0
- {mistralai-1.9.7.dist-info → mistralai-1.9.10.dist-info}/METADATA +1 -1
- {mistralai-1.9.7.dist-info → mistralai-1.9.10.dist-info}/RECORD +48 -35
- mistralai_azure/_hooks/types.py +7 -0
- mistralai_azure/_version.py +3 -3
- mistralai_azure/basesdk.py +12 -20
- mistralai_azure/chat.py +16 -0
- mistralai_azure/httpclient.py +6 -16
- mistralai_azure/models/__init__.py +298 -103
- mistralai_azure/models/assistantmessage.py +1 -1
- mistralai_azure/models/chatcompletionrequest.py +20 -3
- mistralai_azure/models/chatcompletionresponse.py +6 -6
- mistralai_azure/models/chatcompletionstreamrequest.py +20 -3
- mistralai_azure/models/completionresponsestreamchoice.py +1 -1
- mistralai_azure/models/deltamessage.py +1 -1
- mistralai_azure/models/documenturlchunk.py +62 -0
- mistralai_azure/models/filechunk.py +23 -0
- mistralai_azure/models/imageurl.py +1 -1
- mistralai_azure/models/jsonschema.py +1 -1
- mistralai_azure/models/mistralpromptmode.py +8 -0
- mistralai_azure/models/ocrimageobject.py +89 -0
- mistralai_azure/models/ocrpagedimensions.py +25 -0
- mistralai_azure/models/ocrpageobject.py +64 -0
- mistralai_azure/models/ocrrequest.py +120 -0
- mistralai_azure/models/ocrresponse.py +68 -0
- mistralai_azure/models/ocrusageinfo.py +57 -0
- mistralai_azure/models/responseformat.py +1 -1
- mistralai_azure/models/toolmessage.py +1 -1
- mistralai_azure/models/usageinfo.py +71 -8
- mistralai_azure/models/usermessage.py +1 -1
- mistralai_azure/ocr.py +271 -0
- mistralai_azure/sdk.py +45 -17
- mistralai_azure/sdkconfiguration.py +0 -7
- mistralai_azure/types/basemodel.py +3 -3
- mistralai_azure/utils/__init__.py +130 -45
- mistralai_azure/utils/datetimes.py +23 -0
- mistralai_azure/utils/enums.py +67 -27
- mistralai_azure/utils/forms.py +49 -28
- mistralai_azure/utils/serializers.py +32 -3
- {mistralai-1.9.7.dist-info → mistralai-1.9.10.dist-info}/LICENSE +0 -0
- {mistralai-1.9.7.dist-info → mistralai-1.9.10.dist-info}/WHEEL +0 -0
|
@@ -1,50 +1,55 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from
|
|
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
|
-
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
from importlib import import_module
|
|
5
|
+
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
from .annotations import get_discriminator
|
|
8
|
+
from .datetimes import parse_datetime
|
|
9
|
+
from .enums import OpenEnumMeta
|
|
10
|
+
from .headers import get_headers, get_response_headers
|
|
11
|
+
from .metadata import (
|
|
12
|
+
FieldMetadata,
|
|
13
|
+
find_metadata,
|
|
14
|
+
FormMetadata,
|
|
15
|
+
HeaderMetadata,
|
|
16
|
+
MultipartFormMetadata,
|
|
17
|
+
PathParamMetadata,
|
|
18
|
+
QueryParamMetadata,
|
|
19
|
+
RequestMetadata,
|
|
20
|
+
SecurityMetadata,
|
|
21
|
+
)
|
|
22
|
+
from .queryparams import get_query_params
|
|
23
|
+
from .retries import BackoffStrategy, Retries, retry, retry_async, RetryConfig
|
|
24
|
+
from .requestbodies import serialize_request_body, SerializedRequestBody
|
|
25
|
+
from .security import get_security
|
|
26
|
+
from .serializers import (
|
|
27
|
+
get_pydantic_model,
|
|
28
|
+
marshal_json,
|
|
29
|
+
unmarshal,
|
|
30
|
+
unmarshal_json,
|
|
31
|
+
serialize_decimal,
|
|
32
|
+
serialize_float,
|
|
33
|
+
serialize_int,
|
|
34
|
+
stream_to_text,
|
|
35
|
+
stream_to_text_async,
|
|
36
|
+
stream_to_bytes,
|
|
37
|
+
stream_to_bytes_async,
|
|
38
|
+
validate_const,
|
|
39
|
+
validate_decimal,
|
|
40
|
+
validate_float,
|
|
41
|
+
validate_int,
|
|
42
|
+
validate_open_enum,
|
|
43
|
+
)
|
|
44
|
+
from .url import generate_url, template_url, remove_suffix
|
|
45
|
+
from .values import (
|
|
46
|
+
get_global_from_env,
|
|
47
|
+
match_content_type,
|
|
48
|
+
match_status_codes,
|
|
49
|
+
match_response,
|
|
50
|
+
cast_partial,
|
|
51
|
+
)
|
|
52
|
+
from .logger import Logger, get_body_content, get_default_logger
|
|
48
53
|
|
|
49
54
|
__all__ = [
|
|
50
55
|
"BackoffStrategy",
|
|
@@ -55,6 +60,7 @@ __all__ = [
|
|
|
55
60
|
"get_body_content",
|
|
56
61
|
"get_default_logger",
|
|
57
62
|
"get_discriminator",
|
|
63
|
+
"parse_datetime",
|
|
58
64
|
"get_global_from_env",
|
|
59
65
|
"get_headers",
|
|
60
66
|
"get_pydantic_model",
|
|
@@ -97,3 +103,82 @@ __all__ = [
|
|
|
97
103
|
"validate_open_enum",
|
|
98
104
|
"cast_partial",
|
|
99
105
|
]
|
|
106
|
+
|
|
107
|
+
_dynamic_imports: dict[str, str] = {
|
|
108
|
+
"BackoffStrategy": ".retries",
|
|
109
|
+
"FieldMetadata": ".metadata",
|
|
110
|
+
"find_metadata": ".metadata",
|
|
111
|
+
"FormMetadata": ".metadata",
|
|
112
|
+
"generate_url": ".url",
|
|
113
|
+
"get_body_content": ".logger",
|
|
114
|
+
"get_default_logger": ".logger",
|
|
115
|
+
"get_discriminator": ".annotations",
|
|
116
|
+
"parse_datetime": ".datetimes",
|
|
117
|
+
"get_global_from_env": ".values",
|
|
118
|
+
"get_headers": ".headers",
|
|
119
|
+
"get_pydantic_model": ".serializers",
|
|
120
|
+
"get_query_params": ".queryparams",
|
|
121
|
+
"get_response_headers": ".headers",
|
|
122
|
+
"get_security": ".security",
|
|
123
|
+
"HeaderMetadata": ".metadata",
|
|
124
|
+
"Logger": ".logger",
|
|
125
|
+
"marshal_json": ".serializers",
|
|
126
|
+
"match_content_type": ".values",
|
|
127
|
+
"match_status_codes": ".values",
|
|
128
|
+
"match_response": ".values",
|
|
129
|
+
"MultipartFormMetadata": ".metadata",
|
|
130
|
+
"OpenEnumMeta": ".enums",
|
|
131
|
+
"PathParamMetadata": ".metadata",
|
|
132
|
+
"QueryParamMetadata": ".metadata",
|
|
133
|
+
"remove_suffix": ".url",
|
|
134
|
+
"Retries": ".retries",
|
|
135
|
+
"retry": ".retries",
|
|
136
|
+
"retry_async": ".retries",
|
|
137
|
+
"RetryConfig": ".retries",
|
|
138
|
+
"RequestMetadata": ".metadata",
|
|
139
|
+
"SecurityMetadata": ".metadata",
|
|
140
|
+
"serialize_decimal": ".serializers",
|
|
141
|
+
"serialize_float": ".serializers",
|
|
142
|
+
"serialize_int": ".serializers",
|
|
143
|
+
"serialize_request_body": ".requestbodies",
|
|
144
|
+
"SerializedRequestBody": ".requestbodies",
|
|
145
|
+
"stream_to_text": ".serializers",
|
|
146
|
+
"stream_to_text_async": ".serializers",
|
|
147
|
+
"stream_to_bytes": ".serializers",
|
|
148
|
+
"stream_to_bytes_async": ".serializers",
|
|
149
|
+
"template_url": ".url",
|
|
150
|
+
"unmarshal": ".serializers",
|
|
151
|
+
"unmarshal_json": ".serializers",
|
|
152
|
+
"validate_decimal": ".serializers",
|
|
153
|
+
"validate_const": ".serializers",
|
|
154
|
+
"validate_float": ".serializers",
|
|
155
|
+
"validate_int": ".serializers",
|
|
156
|
+
"validate_open_enum": ".serializers",
|
|
157
|
+
"cast_partial": ".values",
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def __getattr__(attr_name: str) -> object:
|
|
162
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
163
|
+
if module_name is None:
|
|
164
|
+
raise AttributeError(
|
|
165
|
+
f"no {attr_name} found in _dynamic_imports, module name -> {__name__} "
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
try:
|
|
169
|
+
module = import_module(module_name, __package__)
|
|
170
|
+
result = getattr(module, attr_name)
|
|
171
|
+
return result
|
|
172
|
+
except ImportError as e:
|
|
173
|
+
raise ImportError(
|
|
174
|
+
f"Failed to import {attr_name} from {module_name}: {e}"
|
|
175
|
+
) from e
|
|
176
|
+
except AttributeError as e:
|
|
177
|
+
raise AttributeError(
|
|
178
|
+
f"Failed to get {attr_name} from {module_name}: {e}"
|
|
179
|
+
) from e
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def __dir__():
|
|
183
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
184
|
+
return sorted(lazy_attrs)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def parse_datetime(datetime_string: str) -> datetime:
|
|
8
|
+
"""
|
|
9
|
+
Convert a RFC 3339 / ISO 8601 formatted string into a datetime object.
|
|
10
|
+
Python versions 3.11 and later support parsing RFC 3339 directly with
|
|
11
|
+
datetime.fromisoformat(), but for earlier versions, this function
|
|
12
|
+
encapsulates the necessary extra logic.
|
|
13
|
+
"""
|
|
14
|
+
# Python 3.11 and later can parse RFC 3339 directly
|
|
15
|
+
if sys.version_info >= (3, 11):
|
|
16
|
+
return datetime.fromisoformat(datetime_string)
|
|
17
|
+
|
|
18
|
+
# For Python 3.10 and earlier, a common ValueError is trailing 'Z' suffix,
|
|
19
|
+
# so fix that upfront.
|
|
20
|
+
if datetime_string.endswith("Z"):
|
|
21
|
+
datetime_string = datetime_string[:-1] + "+00:00"
|
|
22
|
+
|
|
23
|
+
return datetime.fromisoformat(datetime_string)
|
mistralai_azure/utils/enums.py
CHANGED
|
@@ -1,34 +1,74 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
import enum
|
|
4
|
-
|
|
4
|
+
import sys
|
|
5
5
|
|
|
6
6
|
class OpenEnumMeta(enum.EnumMeta):
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
# The __call__ method `boundary` kwarg was added in 3.11 and must be present
|
|
8
|
+
# for pyright. Refer also: https://github.com/pylint-dev/pylint/issues/9622
|
|
9
|
+
# pylint: disable=unexpected-keyword-arg
|
|
10
|
+
# The __call__ method `values` varg must be named for pyright.
|
|
11
|
+
# pylint: disable=keyword-arg-before-vararg
|
|
12
|
+
|
|
13
|
+
if sys.version_info >= (3, 11):
|
|
14
|
+
def __call__(
|
|
15
|
+
cls, value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None
|
|
16
|
+
):
|
|
17
|
+
# The `type` kwarg also happens to be a built-in that pylint flags as
|
|
18
|
+
# redeclared. Safe to ignore this lint rule with this scope.
|
|
19
|
+
# pylint: disable=redefined-builtin
|
|
20
|
+
|
|
21
|
+
if names is not None:
|
|
22
|
+
return super().__call__(
|
|
23
|
+
value,
|
|
24
|
+
names=names,
|
|
25
|
+
*values,
|
|
26
|
+
module=module,
|
|
27
|
+
qualname=qualname,
|
|
28
|
+
type=type,
|
|
29
|
+
start=start,
|
|
30
|
+
boundary=boundary,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
try:
|
|
34
|
+
return super().__call__(
|
|
35
|
+
value,
|
|
36
|
+
names=names, # pyright: ignore[reportArgumentType]
|
|
37
|
+
*values,
|
|
38
|
+
module=module,
|
|
39
|
+
qualname=qualname,
|
|
40
|
+
type=type,
|
|
41
|
+
start=start,
|
|
42
|
+
boundary=boundary,
|
|
43
|
+
)
|
|
44
|
+
except ValueError:
|
|
45
|
+
return value
|
|
46
|
+
else:
|
|
47
|
+
def __call__(
|
|
48
|
+
cls, value, names=None, *, module=None, qualname=None, type=None, start=1
|
|
49
|
+
):
|
|
50
|
+
# The `type` kwarg also happens to be a built-in that pylint flags as
|
|
51
|
+
# redeclared. Safe to ignore this lint rule with this scope.
|
|
52
|
+
# pylint: disable=redefined-builtin
|
|
13
53
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
54
|
+
if names is not None:
|
|
55
|
+
return super().__call__(
|
|
56
|
+
value,
|
|
57
|
+
names=names,
|
|
58
|
+
module=module,
|
|
59
|
+
qualname=qualname,
|
|
60
|
+
type=type,
|
|
61
|
+
start=start,
|
|
62
|
+
)
|
|
23
63
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
64
|
+
try:
|
|
65
|
+
return super().__call__(
|
|
66
|
+
value,
|
|
67
|
+
names=names, # pyright: ignore[reportArgumentType]
|
|
68
|
+
module=module,
|
|
69
|
+
qualname=qualname,
|
|
70
|
+
type=type,
|
|
71
|
+
start=start,
|
|
72
|
+
)
|
|
73
|
+
except ValueError:
|
|
74
|
+
return value
|
mistralai_azure/utils/forms.py
CHANGED
|
@@ -86,11 +86,39 @@ def _populate_form(
|
|
|
86
86
|
return form
|
|
87
87
|
|
|
88
88
|
|
|
89
|
+
def _extract_file_properties(file_obj: Any) -> Tuple[str, Any, Any]:
|
|
90
|
+
"""Extract file name, content, and content type from a file object."""
|
|
91
|
+
file_fields: Dict[str, FieldInfo] = file_obj.__class__.model_fields
|
|
92
|
+
|
|
93
|
+
file_name = ""
|
|
94
|
+
content = None
|
|
95
|
+
content_type = None
|
|
96
|
+
|
|
97
|
+
for file_field_name in file_fields:
|
|
98
|
+
file_field = file_fields[file_field_name]
|
|
99
|
+
|
|
100
|
+
file_metadata = find_field_metadata(file_field, MultipartFormMetadata)
|
|
101
|
+
if file_metadata is None:
|
|
102
|
+
continue
|
|
103
|
+
|
|
104
|
+
if file_metadata.content:
|
|
105
|
+
content = getattr(file_obj, file_field_name, None)
|
|
106
|
+
elif file_field_name == "content_type":
|
|
107
|
+
content_type = getattr(file_obj, file_field_name, None)
|
|
108
|
+
else:
|
|
109
|
+
file_name = getattr(file_obj, file_field_name)
|
|
110
|
+
|
|
111
|
+
if file_name == "" or content is None:
|
|
112
|
+
raise ValueError("invalid multipart/form-data file")
|
|
113
|
+
|
|
114
|
+
return file_name, content, content_type
|
|
115
|
+
|
|
116
|
+
|
|
89
117
|
def serialize_multipart_form(
|
|
90
118
|
media_type: str, request: Any
|
|
91
|
-
) -> Tuple[str, Dict[str, Any],
|
|
119
|
+
) -> Tuple[str, Dict[str, Any], List[Tuple[str, Any]]]:
|
|
92
120
|
form: Dict[str, Any] = {}
|
|
93
|
-
files:
|
|
121
|
+
files: List[Tuple[str, Any]] = []
|
|
94
122
|
|
|
95
123
|
if not isinstance(request, BaseModel):
|
|
96
124
|
raise TypeError("invalid request body type")
|
|
@@ -112,39 +140,32 @@ def serialize_multipart_form(
|
|
|
112
140
|
f_name = field.alias if field.alias else name
|
|
113
141
|
|
|
114
142
|
if field_metadata.file:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
file_field = file_fields[file_field_name]
|
|
143
|
+
if isinstance(val, List):
|
|
144
|
+
# Handle array of files
|
|
145
|
+
for file_obj in val:
|
|
146
|
+
if not _is_set(file_obj):
|
|
147
|
+
continue
|
|
148
|
+
|
|
149
|
+
file_name, content, content_type = _extract_file_properties(file_obj)
|
|
123
150
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
151
|
+
if content_type is not None:
|
|
152
|
+
files.append((f_name + "[]", (file_name, content, content_type)))
|
|
153
|
+
else:
|
|
154
|
+
files.append((f_name + "[]", (file_name, content)))
|
|
155
|
+
else:
|
|
156
|
+
# Handle single file
|
|
157
|
+
file_name, content, content_type = _extract_file_properties(val)
|
|
127
158
|
|
|
128
|
-
if
|
|
129
|
-
|
|
130
|
-
elif file_field_name == "content_type":
|
|
131
|
-
content_type = getattr(val, file_field_name, None)
|
|
159
|
+
if content_type is not None:
|
|
160
|
+
files.append((f_name, (file_name, content, content_type)))
|
|
132
161
|
else:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if file_name == "" or content is None:
|
|
136
|
-
raise ValueError("invalid multipart/form-data file")
|
|
137
|
-
|
|
138
|
-
if content_type is not None:
|
|
139
|
-
files[f_name] = (file_name, content, content_type)
|
|
140
|
-
else:
|
|
141
|
-
files[f_name] = (file_name, content)
|
|
162
|
+
files.append((f_name, (file_name, content)))
|
|
142
163
|
elif field_metadata.json:
|
|
143
|
-
files
|
|
164
|
+
files.append((f_name, (
|
|
144
165
|
None,
|
|
145
166
|
marshal_json(val, request_field_types[name]),
|
|
146
167
|
"application/json",
|
|
147
|
-
)
|
|
168
|
+
)))
|
|
148
169
|
else:
|
|
149
170
|
if isinstance(val, List):
|
|
150
171
|
values = []
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from decimal import Decimal
|
|
4
|
+
import functools
|
|
4
5
|
import json
|
|
5
|
-
|
|
6
|
-
import
|
|
6
|
+
import typing
|
|
7
|
+
from typing import Any, Dict, List, Tuple, Union, get_args
|
|
8
|
+
import typing_extensions
|
|
7
9
|
from typing_extensions import get_origin
|
|
10
|
+
|
|
11
|
+
import httpx
|
|
8
12
|
from pydantic import ConfigDict, create_model
|
|
9
13
|
from pydantic_core import from_json
|
|
10
|
-
from typing_inspection.typing_objects import is_union
|
|
11
14
|
|
|
12
15
|
from ..types.basemodel import BaseModel, Nullable, OptionalNullable, Unset
|
|
13
16
|
|
|
@@ -185,6 +188,13 @@ def is_nullable(field):
|
|
|
185
188
|
return False
|
|
186
189
|
|
|
187
190
|
|
|
191
|
+
def is_union(obj: object) -> bool:
|
|
192
|
+
"""
|
|
193
|
+
Returns True if the given object is a typing.Union or typing_extensions.Union.
|
|
194
|
+
"""
|
|
195
|
+
return any(obj is typing_obj for typing_obj in _get_typing_objects_by_name_of("Union"))
|
|
196
|
+
|
|
197
|
+
|
|
188
198
|
def stream_to_text(stream: httpx.Response) -> str:
|
|
189
199
|
return "".join(stream.iter_text())
|
|
190
200
|
|
|
@@ -217,3 +227,22 @@ def _contains_pydantic_model(data: Any) -> bool:
|
|
|
217
227
|
return any(_contains_pydantic_model(value) for value in data.values())
|
|
218
228
|
|
|
219
229
|
return False
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
@functools.cache
|
|
233
|
+
def _get_typing_objects_by_name_of(name: str) -> Tuple[Any, ...]:
|
|
234
|
+
"""
|
|
235
|
+
Get typing objects by name from typing and typing_extensions.
|
|
236
|
+
Reference: https://typing-extensions.readthedocs.io/en/latest/#runtime-use-of-types
|
|
237
|
+
"""
|
|
238
|
+
result = tuple(
|
|
239
|
+
getattr(module, name)
|
|
240
|
+
for module in (typing, typing_extensions)
|
|
241
|
+
if hasattr(module, name)
|
|
242
|
+
)
|
|
243
|
+
if not result:
|
|
244
|
+
raise ValueError(
|
|
245
|
+
f"Neither typing nor typing_extensions has an object called {name!r}"
|
|
246
|
+
)
|
|
247
|
+
return result
|
|
248
|
+
|
|
File without changes
|
|
File without changes
|