@typespec/http-client-python 0.14.3-dev.1 → 0.15.1
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.
- package/dist/emitter/http.d.ts.map +1 -1
- package/dist/emitter/http.js.map +1 -1
- package/dist/emitter/types.d.ts.map +1 -1
- package/dist/emitter/types.js +4 -14
- package/dist/emitter/types.js.map +1 -1
- package/dist/emitter/utils.d.ts +5 -5
- package/dist/emitter/utils.d.ts.map +1 -1
- package/dist/emitter/utils.js +5 -3
- package/dist/emitter/utils.js.map +1 -1
- package/emitter/src/http.ts +6 -3
- package/emitter/src/types.ts +6 -15
- package/emitter/src/utils.ts +19 -8
- package/emitter/temp/tsconfig.tsbuildinfo +1 -1
- package/eng/scripts/ci/regenerate.ts +10 -8
- package/eng/scripts/setup/__pycache__/package_manager.cpython-39.pyc +0 -0
- package/eng/scripts/setup/__pycache__/venvtools.cpython-39.pyc +0 -0
- package/generator/build/lib/pygen/__init__.py +13 -1
- package/generator/build/lib/pygen/codegen/models/enum_type.py +4 -1
- package/generator/build/lib/pygen/codegen/models/model_type.py +4 -1
- package/generator/build/lib/pygen/codegen/serializers/__init__.py +10 -3
- package/generator/build/lib/pygen/codegen/serializers/builder_serializer.py +4 -4
- package/generator/build/lib/pygen/codegen/templates/model_base.py.jinja2 +5 -4
- package/generator/build/lib/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2 +3 -3
- package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
- package/generator/pygen/__init__.py +13 -1
- package/generator/pygen/codegen/models/enum_type.py +4 -1
- package/generator/pygen/codegen/models/model_type.py +4 -1
- package/generator/pygen/codegen/serializers/__init__.py +10 -3
- package/generator/pygen/codegen/serializers/builder_serializer.py +4 -4
- package/generator/pygen/codegen/templates/model_base.py.jinja2 +5 -4
- package/generator/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2 +3 -3
- package/package.json +35 -35
|
@@ -21,6 +21,14 @@ const argv = parseArgs({
|
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
+
// Add this near the top with other constants
|
|
25
|
+
const SKIP_SPECS = [
|
|
26
|
+
"type/union/discriminated",
|
|
27
|
+
"client-operation-group",
|
|
28
|
+
"azure/client-generator-core/api-version",
|
|
29
|
+
"azure/client-generator-core/hierarchy-building",
|
|
30
|
+
];
|
|
31
|
+
|
|
24
32
|
// Get the directory of the current file
|
|
25
33
|
const PLUGIN_DIR = argv.values.pluginDir
|
|
26
34
|
? resolve(argv.values.pluginDir)
|
|
@@ -316,14 +324,8 @@ async function getSubdirectories(baseDir: string, flags: RegenerateFlags): Promi
|
|
|
316
324
|
|
|
317
325
|
const mainTspRelativePath = toPosix(relative(baseDir, mainTspPath));
|
|
318
326
|
|
|
319
|
-
//
|
|
320
|
-
if (mainTspRelativePath.includes(
|
|
321
|
-
|
|
322
|
-
// after fix test generation for nested operation group, remove this check
|
|
323
|
-
if (mainTspRelativePath.includes("client-operation-group")) return;
|
|
324
|
-
|
|
325
|
-
// after https://github.com/Azure/autorest.python/issues/3043 fixed, remove this check
|
|
326
|
-
if (mainTspRelativePath.includes("azure/client-generator-core/api-version")) return;
|
|
327
|
+
// Replace the individual skip checks with:
|
|
328
|
+
if (SKIP_SPECS.some((skipSpec) => mainTspRelativePath.includes(skipSpec))) return;
|
|
327
329
|
|
|
328
330
|
const hasMainTsp = await promises
|
|
329
331
|
.access(mainTspPath)
|
|
Binary file
|
|
Binary file
|
|
@@ -46,7 +46,7 @@ class OptionsDict(MutableMapping):
|
|
|
46
46
|
self._data = options.copy() if options else {}
|
|
47
47
|
self._validate_combinations()
|
|
48
48
|
|
|
49
|
-
def __getitem__(self, key: str) -> Any:
|
|
49
|
+
def __getitem__(self, key: str) -> Any: # pylint: disable=too-many-return-statements
|
|
50
50
|
if key == "head-as-boolean" and self.get("azure-arm"):
|
|
51
51
|
# override to always true if azure-arm is set
|
|
52
52
|
return True
|
|
@@ -61,6 +61,18 @@ class OptionsDict(MutableMapping):
|
|
|
61
61
|
if key == "package-mode" and self._data.get("packaging-files-dir"):
|
|
62
62
|
# if packaging-files-dir is set, use it as package-mode
|
|
63
63
|
return self._data["packaging-files-dir"]
|
|
64
|
+
if key == "generation-subdir":
|
|
65
|
+
data = self._data.get("generation-subdir")
|
|
66
|
+
if data:
|
|
67
|
+
# Remove leading dot or ./ from generation-subdir
|
|
68
|
+
if data.startswith("./"):
|
|
69
|
+
data = data[2:]
|
|
70
|
+
elif data.startswith("."):
|
|
71
|
+
data = data[1:]
|
|
72
|
+
# Remove trailing slashes
|
|
73
|
+
if data.endswith("/") or data.endswith("\\"):
|
|
74
|
+
data = data[:-1]
|
|
75
|
+
return data
|
|
64
76
|
return self._get_default(key)
|
|
65
77
|
|
|
66
78
|
def __setitem__(self, key: str, value: Any) -> None:
|
|
@@ -52,7 +52,10 @@ class EnumValue(BaseType):
|
|
|
52
52
|
"""The python type used for RST syntax input and type annotation."""
|
|
53
53
|
|
|
54
54
|
type_annotation = self.value_type.type_annotation(**kwargs)
|
|
55
|
-
|
|
55
|
+
client_namespace = self.enum_type.client_namespace
|
|
56
|
+
if self.code_model.options.get("generation-subdir"):
|
|
57
|
+
client_namespace += f".{self.code_model.options['generation-subdir']}"
|
|
58
|
+
enum_type_annotation = f"{client_namespace}.models.{self.name}"
|
|
56
59
|
return f"{type_annotation} or ~{enum_type_annotation}"
|
|
57
60
|
|
|
58
61
|
def get_json_template_representation(
|
|
@@ -292,7 +292,10 @@ class GeneratedModelType(ModelType):
|
|
|
292
292
|
|
|
293
293
|
def docstring_type(self, **kwargs: Any) -> str:
|
|
294
294
|
type_annotation = self.type_annotation(need_model_alias=False, skip_quote=True, **kwargs)
|
|
295
|
-
|
|
295
|
+
client_namespace = self.client_namespace
|
|
296
|
+
if self.code_model.options.get("generation-subdir"):
|
|
297
|
+
client_namespace += f".{self.code_model.options['generation-subdir']}"
|
|
298
|
+
return f"~{client_namespace}.models.{type_annotation}"
|
|
296
299
|
|
|
297
300
|
def docstring_text(self, **kwargs: Any) -> str:
|
|
298
301
|
return self.name
|
|
@@ -7,7 +7,7 @@ import logging
|
|
|
7
7
|
import json
|
|
8
8
|
from collections import namedtuple
|
|
9
9
|
import re
|
|
10
|
-
from typing import List, Any, Union
|
|
10
|
+
from typing import List, Any, Union, Optional
|
|
11
11
|
from pathlib import Path
|
|
12
12
|
from packaging.version import parse as parse_version
|
|
13
13
|
from jinja2 import PackageLoader, Environment, FileSystemLoader, StrictUndefined
|
|
@@ -165,7 +165,7 @@ class JinjaSerializer(ReaderAndWriter):
|
|
|
165
165
|
# add _metadata.json
|
|
166
166
|
if self.code_model.metadata:
|
|
167
167
|
self.write_file(
|
|
168
|
-
|
|
168
|
+
Path("./_metadata.json"),
|
|
169
169
|
json.dumps(self.code_model.metadata, indent=2),
|
|
170
170
|
)
|
|
171
171
|
elif client_namespace_type.clients:
|
|
@@ -376,8 +376,12 @@ class JinjaSerializer(ReaderAndWriter):
|
|
|
376
376
|
def _serialize_and_write_version_file(
|
|
377
377
|
self,
|
|
378
378
|
general_serializer: GeneralSerializer,
|
|
379
|
+
namespace: Optional[str] = None,
|
|
379
380
|
):
|
|
380
|
-
|
|
381
|
+
if namespace:
|
|
382
|
+
generation_path = self.code_model.get_generation_dir(namespace)
|
|
383
|
+
else:
|
|
384
|
+
generation_path = self.code_model.get_root_dir()
|
|
381
385
|
|
|
382
386
|
def _read_version_file(original_version_file_name: str) -> str:
|
|
383
387
|
return self.read_file(generation_path / original_version_file_name)
|
|
@@ -472,6 +476,9 @@ class JinjaSerializer(ReaderAndWriter):
|
|
|
472
476
|
|
|
473
477
|
# write _version.py
|
|
474
478
|
self._serialize_and_write_version_file(general_serializer)
|
|
479
|
+
# if there's a subdir, we need to write another version file in the subdir
|
|
480
|
+
if self.code_model.options.get("generation-subdir"):
|
|
481
|
+
self._serialize_and_write_version_file(general_serializer, namespace)
|
|
475
482
|
|
|
476
483
|
# write the empty py.typed file
|
|
477
484
|
pytyped_value = "# Marker file for PEP 561."
|
|
@@ -1032,7 +1032,7 @@ class _OperationSerializer(_BuilderBaseSerializer[OperationType]):
|
|
|
1032
1032
|
is_operation_file=True, skip_quote=True, serialize_namespace=self.serialize_namespace
|
|
1033
1033
|
)
|
|
1034
1034
|
if self.code_model.options["models-mode"] == "dpg":
|
|
1035
|
-
retval.append(f" error = _failsafe_deserialize({type_annotation}, response
|
|
1035
|
+
retval.append(f" error = _failsafe_deserialize({type_annotation}, response)")
|
|
1036
1036
|
else:
|
|
1037
1037
|
retval.append(
|
|
1038
1038
|
f" error = self._deserialize.failsafe_deserialize({type_annotation}, "
|
|
@@ -1068,10 +1068,10 @@ class _OperationSerializer(_BuilderBaseSerializer[OperationType]):
|
|
|
1068
1068
|
if self.code_model.options["models-mode"] == "dpg":
|
|
1069
1069
|
if xml_serializable(str(e.default_content_type)):
|
|
1070
1070
|
retval.append(
|
|
1071
|
-
f" error = _failsafe_deserialize_xml({type_annotation},
|
|
1071
|
+
f" error = _failsafe_deserialize_xml({type_annotation}, response)"
|
|
1072
1072
|
)
|
|
1073
1073
|
else:
|
|
1074
|
-
retval.append(f" error = _failsafe_deserialize({type_annotation},
|
|
1074
|
+
retval.append(f" error = _failsafe_deserialize({type_annotation}, response)")
|
|
1075
1075
|
else:
|
|
1076
1076
|
retval.append(
|
|
1077
1077
|
f" error = self._deserialize.failsafe_deserialize({type_annotation}, "
|
|
@@ -1087,7 +1087,7 @@ class _OperationSerializer(_BuilderBaseSerializer[OperationType]):
|
|
|
1087
1087
|
retval.append(" else:")
|
|
1088
1088
|
if self.code_model.options["models-mode"] == "dpg":
|
|
1089
1089
|
retval.append(
|
|
1090
|
-
f"{indent}error = _failsafe_deserialize({default_error_deserialization},
|
|
1090
|
+
f"{indent}error = _failsafe_deserialize({default_error_deserialization}, response)"
|
|
1091
1091
|
)
|
|
1092
1092
|
else:
|
|
1093
1093
|
retval.append(
|
|
@@ -25,6 +25,7 @@ from {{ code_model.core_library }}.exceptions import DeserializationError
|
|
|
25
25
|
from {{ code_model.core_library }}{{ "" if code_model.is_azure_flavor else ".utils" }} import CaseInsensitiveEnumMeta
|
|
26
26
|
from {{ code_model.core_library }}.{{ "" if code_model.is_azure_flavor else "runtime." }}pipeline import PipelineResponse
|
|
27
27
|
from {{ code_model.core_library }}.serialization import _Null
|
|
28
|
+
from {{ code_model.core_library }}.rest import HttpResponse
|
|
28
29
|
|
|
29
30
|
_LOGGER = logging.getLogger(__name__)
|
|
30
31
|
|
|
@@ -935,13 +936,13 @@ def _deserialize(
|
|
|
935
936
|
|
|
936
937
|
def _failsafe_deserialize(
|
|
937
938
|
deserializer: typing.Any,
|
|
938
|
-
|
|
939
|
+
response: HttpResponse,
|
|
939
940
|
module: typing.Optional[str] = None,
|
|
940
941
|
rf: typing.Optional["_RestField"] = None,
|
|
941
942
|
format: typing.Optional[str] = None,
|
|
942
943
|
) -> typing.Any:
|
|
943
944
|
try:
|
|
944
|
-
return _deserialize(deserializer,
|
|
945
|
+
return _deserialize(deserializer, response.json(), module, rf, format)
|
|
945
946
|
except DeserializationError:
|
|
946
947
|
_LOGGER.warning(
|
|
947
948
|
"Ran into a deserialization error. Ignoring since this is failsafe deserialization",
|
|
@@ -952,10 +953,10 @@ def _failsafe_deserialize(
|
|
|
952
953
|
|
|
953
954
|
def _failsafe_deserialize_xml(
|
|
954
955
|
deserializer: typing.Any,
|
|
955
|
-
|
|
956
|
+
response: HttpResponse,
|
|
956
957
|
) -> typing.Any:
|
|
957
958
|
try:
|
|
958
|
-
return _deserialize_xml(deserializer,
|
|
959
|
+
return _deserialize_xml(deserializer, response.text())
|
|
959
960
|
except DeserializationError:
|
|
960
961
|
_LOGGER.warning(
|
|
961
962
|
"Ran into a deserialization error. Ignoring since this is failsafe deserialization",
|
package/generator/build/lib/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
{% endif %}
|
|
6
6
|
|
|
7
7
|
[build-system]
|
|
8
|
-
requires = ["setuptools>=
|
|
8
|
+
requires = ["setuptools>=77.0.3", "wheel"]
|
|
9
9
|
build-backend = "setuptools.build_meta"
|
|
10
10
|
|
|
11
11
|
[project]
|
|
@@ -15,7 +15,7 @@ authors = [
|
|
|
15
15
|
{ name = "{{ code_model.company_name }}"{% if code_model.is_azure_flavor %}, email = "azpysdkhelp@microsoft.com"{% endif %} },
|
|
16
16
|
]
|
|
17
17
|
description = "{{ code_model.company_name }} {% if code_model.is_azure_flavor and not options.get('package-pprint-name').startswith('Azure ') %}Azure {% endif %}{{ options.get('package-pprint-name') }} Client Library for Python"
|
|
18
|
-
license =
|
|
18
|
+
license = "MIT"
|
|
19
19
|
classifiers = [
|
|
20
20
|
"Development Status :: {{ dev_status }}",
|
|
21
21
|
"Programming Language :: Python",
|
|
@@ -24,7 +24,6 @@ classifiers = [
|
|
|
24
24
|
{% for version in range(min_version, max_version + 1) %}
|
|
25
25
|
"Programming Language :: Python :: 3.{{ version }}",
|
|
26
26
|
{% endfor %}
|
|
27
|
-
"License :: OSI Approved :: MIT License",
|
|
28
27
|
]
|
|
29
28
|
requires-python = ">={{ MIN_PYTHON_VERSION }}"
|
|
30
29
|
{% else %}
|
|
@@ -92,6 +91,7 @@ readme = {file = ["README.md"], content-type = "text/markdown"}
|
|
|
92
91
|
exclude = [
|
|
93
92
|
"tests*",
|
|
94
93
|
"samples*",
|
|
94
|
+
"doc*",
|
|
95
95
|
{% for pkgutil_name in pkgutil_names %}
|
|
96
96
|
"{{ pkgutil_name }}",
|
|
97
97
|
{% endfor %}
|
|
Binary file
|
|
@@ -46,7 +46,7 @@ class OptionsDict(MutableMapping):
|
|
|
46
46
|
self._data = options.copy() if options else {}
|
|
47
47
|
self._validate_combinations()
|
|
48
48
|
|
|
49
|
-
def __getitem__(self, key: str) -> Any:
|
|
49
|
+
def __getitem__(self, key: str) -> Any: # pylint: disable=too-many-return-statements
|
|
50
50
|
if key == "head-as-boolean" and self.get("azure-arm"):
|
|
51
51
|
# override to always true if azure-arm is set
|
|
52
52
|
return True
|
|
@@ -61,6 +61,18 @@ class OptionsDict(MutableMapping):
|
|
|
61
61
|
if key == "package-mode" and self._data.get("packaging-files-dir"):
|
|
62
62
|
# if packaging-files-dir is set, use it as package-mode
|
|
63
63
|
return self._data["packaging-files-dir"]
|
|
64
|
+
if key == "generation-subdir":
|
|
65
|
+
data = self._data.get("generation-subdir")
|
|
66
|
+
if data:
|
|
67
|
+
# Remove leading dot or ./ from generation-subdir
|
|
68
|
+
if data.startswith("./"):
|
|
69
|
+
data = data[2:]
|
|
70
|
+
elif data.startswith("."):
|
|
71
|
+
data = data[1:]
|
|
72
|
+
# Remove trailing slashes
|
|
73
|
+
if data.endswith("/") or data.endswith("\\"):
|
|
74
|
+
data = data[:-1]
|
|
75
|
+
return data
|
|
64
76
|
return self._get_default(key)
|
|
65
77
|
|
|
66
78
|
def __setitem__(self, key: str, value: Any) -> None:
|
|
@@ -52,7 +52,10 @@ class EnumValue(BaseType):
|
|
|
52
52
|
"""The python type used for RST syntax input and type annotation."""
|
|
53
53
|
|
|
54
54
|
type_annotation = self.value_type.type_annotation(**kwargs)
|
|
55
|
-
|
|
55
|
+
client_namespace = self.enum_type.client_namespace
|
|
56
|
+
if self.code_model.options.get("generation-subdir"):
|
|
57
|
+
client_namespace += f".{self.code_model.options['generation-subdir']}"
|
|
58
|
+
enum_type_annotation = f"{client_namespace}.models.{self.name}"
|
|
56
59
|
return f"{type_annotation} or ~{enum_type_annotation}"
|
|
57
60
|
|
|
58
61
|
def get_json_template_representation(
|
|
@@ -292,7 +292,10 @@ class GeneratedModelType(ModelType):
|
|
|
292
292
|
|
|
293
293
|
def docstring_type(self, **kwargs: Any) -> str:
|
|
294
294
|
type_annotation = self.type_annotation(need_model_alias=False, skip_quote=True, **kwargs)
|
|
295
|
-
|
|
295
|
+
client_namespace = self.client_namespace
|
|
296
|
+
if self.code_model.options.get("generation-subdir"):
|
|
297
|
+
client_namespace += f".{self.code_model.options['generation-subdir']}"
|
|
298
|
+
return f"~{client_namespace}.models.{type_annotation}"
|
|
296
299
|
|
|
297
300
|
def docstring_text(self, **kwargs: Any) -> str:
|
|
298
301
|
return self.name
|
|
@@ -7,7 +7,7 @@ import logging
|
|
|
7
7
|
import json
|
|
8
8
|
from collections import namedtuple
|
|
9
9
|
import re
|
|
10
|
-
from typing import List, Any, Union
|
|
10
|
+
from typing import List, Any, Union, Optional
|
|
11
11
|
from pathlib import Path
|
|
12
12
|
from packaging.version import parse as parse_version
|
|
13
13
|
from jinja2 import PackageLoader, Environment, FileSystemLoader, StrictUndefined
|
|
@@ -165,7 +165,7 @@ class JinjaSerializer(ReaderAndWriter):
|
|
|
165
165
|
# add _metadata.json
|
|
166
166
|
if self.code_model.metadata:
|
|
167
167
|
self.write_file(
|
|
168
|
-
|
|
168
|
+
Path("./_metadata.json"),
|
|
169
169
|
json.dumps(self.code_model.metadata, indent=2),
|
|
170
170
|
)
|
|
171
171
|
elif client_namespace_type.clients:
|
|
@@ -376,8 +376,12 @@ class JinjaSerializer(ReaderAndWriter):
|
|
|
376
376
|
def _serialize_and_write_version_file(
|
|
377
377
|
self,
|
|
378
378
|
general_serializer: GeneralSerializer,
|
|
379
|
+
namespace: Optional[str] = None,
|
|
379
380
|
):
|
|
380
|
-
|
|
381
|
+
if namespace:
|
|
382
|
+
generation_path = self.code_model.get_generation_dir(namespace)
|
|
383
|
+
else:
|
|
384
|
+
generation_path = self.code_model.get_root_dir()
|
|
381
385
|
|
|
382
386
|
def _read_version_file(original_version_file_name: str) -> str:
|
|
383
387
|
return self.read_file(generation_path / original_version_file_name)
|
|
@@ -472,6 +476,9 @@ class JinjaSerializer(ReaderAndWriter):
|
|
|
472
476
|
|
|
473
477
|
# write _version.py
|
|
474
478
|
self._serialize_and_write_version_file(general_serializer)
|
|
479
|
+
# if there's a subdir, we need to write another version file in the subdir
|
|
480
|
+
if self.code_model.options.get("generation-subdir"):
|
|
481
|
+
self._serialize_and_write_version_file(general_serializer, namespace)
|
|
475
482
|
|
|
476
483
|
# write the empty py.typed file
|
|
477
484
|
pytyped_value = "# Marker file for PEP 561."
|
|
@@ -1032,7 +1032,7 @@ class _OperationSerializer(_BuilderBaseSerializer[OperationType]):
|
|
|
1032
1032
|
is_operation_file=True, skip_quote=True, serialize_namespace=self.serialize_namespace
|
|
1033
1033
|
)
|
|
1034
1034
|
if self.code_model.options["models-mode"] == "dpg":
|
|
1035
|
-
retval.append(f" error = _failsafe_deserialize({type_annotation}, response
|
|
1035
|
+
retval.append(f" error = _failsafe_deserialize({type_annotation}, response)")
|
|
1036
1036
|
else:
|
|
1037
1037
|
retval.append(
|
|
1038
1038
|
f" error = self._deserialize.failsafe_deserialize({type_annotation}, "
|
|
@@ -1068,10 +1068,10 @@ class _OperationSerializer(_BuilderBaseSerializer[OperationType]):
|
|
|
1068
1068
|
if self.code_model.options["models-mode"] == "dpg":
|
|
1069
1069
|
if xml_serializable(str(e.default_content_type)):
|
|
1070
1070
|
retval.append(
|
|
1071
|
-
f" error = _failsafe_deserialize_xml({type_annotation},
|
|
1071
|
+
f" error = _failsafe_deserialize_xml({type_annotation}, response)"
|
|
1072
1072
|
)
|
|
1073
1073
|
else:
|
|
1074
|
-
retval.append(f" error = _failsafe_deserialize({type_annotation},
|
|
1074
|
+
retval.append(f" error = _failsafe_deserialize({type_annotation}, response)")
|
|
1075
1075
|
else:
|
|
1076
1076
|
retval.append(
|
|
1077
1077
|
f" error = self._deserialize.failsafe_deserialize({type_annotation}, "
|
|
@@ -1087,7 +1087,7 @@ class _OperationSerializer(_BuilderBaseSerializer[OperationType]):
|
|
|
1087
1087
|
retval.append(" else:")
|
|
1088
1088
|
if self.code_model.options["models-mode"] == "dpg":
|
|
1089
1089
|
retval.append(
|
|
1090
|
-
f"{indent}error = _failsafe_deserialize({default_error_deserialization},
|
|
1090
|
+
f"{indent}error = _failsafe_deserialize({default_error_deserialization}, response)"
|
|
1091
1091
|
)
|
|
1092
1092
|
else:
|
|
1093
1093
|
retval.append(
|
|
@@ -25,6 +25,7 @@ from {{ code_model.core_library }}.exceptions import DeserializationError
|
|
|
25
25
|
from {{ code_model.core_library }}{{ "" if code_model.is_azure_flavor else ".utils" }} import CaseInsensitiveEnumMeta
|
|
26
26
|
from {{ code_model.core_library }}.{{ "" if code_model.is_azure_flavor else "runtime." }}pipeline import PipelineResponse
|
|
27
27
|
from {{ code_model.core_library }}.serialization import _Null
|
|
28
|
+
from {{ code_model.core_library }}.rest import HttpResponse
|
|
28
29
|
|
|
29
30
|
_LOGGER = logging.getLogger(__name__)
|
|
30
31
|
|
|
@@ -935,13 +936,13 @@ def _deserialize(
|
|
|
935
936
|
|
|
936
937
|
def _failsafe_deserialize(
|
|
937
938
|
deserializer: typing.Any,
|
|
938
|
-
|
|
939
|
+
response: HttpResponse,
|
|
939
940
|
module: typing.Optional[str] = None,
|
|
940
941
|
rf: typing.Optional["_RestField"] = None,
|
|
941
942
|
format: typing.Optional[str] = None,
|
|
942
943
|
) -> typing.Any:
|
|
943
944
|
try:
|
|
944
|
-
return _deserialize(deserializer,
|
|
945
|
+
return _deserialize(deserializer, response.json(), module, rf, format)
|
|
945
946
|
except DeserializationError:
|
|
946
947
|
_LOGGER.warning(
|
|
947
948
|
"Ran into a deserialization error. Ignoring since this is failsafe deserialization",
|
|
@@ -952,10 +953,10 @@ def _failsafe_deserialize(
|
|
|
952
953
|
|
|
953
954
|
def _failsafe_deserialize_xml(
|
|
954
955
|
deserializer: typing.Any,
|
|
955
|
-
|
|
956
|
+
response: HttpResponse,
|
|
956
957
|
) -> typing.Any:
|
|
957
958
|
try:
|
|
958
|
-
return _deserialize_xml(deserializer,
|
|
959
|
+
return _deserialize_xml(deserializer, response.text())
|
|
959
960
|
except DeserializationError:
|
|
960
961
|
_LOGGER.warning(
|
|
961
962
|
"Ran into a deserialization error. Ignoring since this is failsafe deserialization",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
{% endif %}
|
|
6
6
|
|
|
7
7
|
[build-system]
|
|
8
|
-
requires = ["setuptools>=
|
|
8
|
+
requires = ["setuptools>=77.0.3", "wheel"]
|
|
9
9
|
build-backend = "setuptools.build_meta"
|
|
10
10
|
|
|
11
11
|
[project]
|
|
@@ -15,7 +15,7 @@ authors = [
|
|
|
15
15
|
{ name = "{{ code_model.company_name }}"{% if code_model.is_azure_flavor %}, email = "azpysdkhelp@microsoft.com"{% endif %} },
|
|
16
16
|
]
|
|
17
17
|
description = "{{ code_model.company_name }} {% if code_model.is_azure_flavor and not options.get('package-pprint-name').startswith('Azure ') %}Azure {% endif %}{{ options.get('package-pprint-name') }} Client Library for Python"
|
|
18
|
-
license =
|
|
18
|
+
license = "MIT"
|
|
19
19
|
classifiers = [
|
|
20
20
|
"Development Status :: {{ dev_status }}",
|
|
21
21
|
"Programming Language :: Python",
|
|
@@ -24,7 +24,6 @@ classifiers = [
|
|
|
24
24
|
{% for version in range(min_version, max_version + 1) %}
|
|
25
25
|
"Programming Language :: Python :: 3.{{ version }}",
|
|
26
26
|
{% endfor %}
|
|
27
|
-
"License :: OSI Approved :: MIT License",
|
|
28
27
|
]
|
|
29
28
|
requires-python = ">={{ MIN_PYTHON_VERSION }}"
|
|
30
29
|
{% else %}
|
|
@@ -92,6 +91,7 @@ readme = {file = ["README.md"], content-type = "text/markdown"}
|
|
|
92
91
|
exclude = [
|
|
93
92
|
"tests*",
|
|
94
93
|
"samples*",
|
|
94
|
+
"doc*",
|
|
95
95
|
{% for pkgutil_name in pkgutil_names %}
|
|
96
96
|
"{{ pkgutil_name }}",
|
|
97
97
|
{% endfor %}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/http-client-python",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec emitter for Python SDKs",
|
|
6
6
|
"homepage": "https://typespec.io",
|
|
@@ -54,20 +54,20 @@
|
|
|
54
54
|
"emitter"
|
|
55
55
|
],
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@azure-tools/typespec-autorest": ">=0.
|
|
58
|
-
"@azure-tools/typespec-azure-core": ">=0.
|
|
59
|
-
"@azure-tools/typespec-azure-resource-manager": ">=0.
|
|
60
|
-
"@azure-tools/typespec-azure-rulesets": ">=0.
|
|
61
|
-
"@azure-tools/typespec-client-generator-core": ">=0.
|
|
62
|
-
"@typespec/compiler": "^1.
|
|
63
|
-
"@typespec/http": "^1.
|
|
64
|
-
"@typespec/openapi": "^1.
|
|
65
|
-
"@typespec/rest": ">=0.
|
|
66
|
-
"@typespec/versioning": ">=0.
|
|
67
|
-
"@typespec/events": ">=0.
|
|
68
|
-
"@typespec/sse": ">=0.
|
|
69
|
-
"@typespec/streams": ">=0.
|
|
70
|
-
"@typespec/xml": ">=0.
|
|
57
|
+
"@azure-tools/typespec-autorest": ">=0.59.0 <1.0.0",
|
|
58
|
+
"@azure-tools/typespec-azure-core": ">=0.59.0 <1.0.0",
|
|
59
|
+
"@azure-tools/typespec-azure-resource-manager": ">=0.59.0 <1.0.0",
|
|
60
|
+
"@azure-tools/typespec-azure-rulesets": ">=0.59.0 <1.0.0",
|
|
61
|
+
"@azure-tools/typespec-client-generator-core": ">=0.59.0 <1.0.0",
|
|
62
|
+
"@typespec/compiler": "^1.3.0",
|
|
63
|
+
"@typespec/http": "^1.3.0",
|
|
64
|
+
"@typespec/openapi": "^1.3.0",
|
|
65
|
+
"@typespec/rest": ">=0.73.0 <1.0.0",
|
|
66
|
+
"@typespec/versioning": ">=0.73.0 <1.0.0",
|
|
67
|
+
"@typespec/events": ">=0.73.0 <1.0.0",
|
|
68
|
+
"@typespec/sse": ">=0.73.0 <1.0.0",
|
|
69
|
+
"@typespec/streams": ">=0.73.0 <1.0.0",
|
|
70
|
+
"@typespec/xml": ">=0.73.0 <1.0.0"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"js-yaml": "~4.1.0",
|
|
@@ -77,32 +77,32 @@
|
|
|
77
77
|
"tsx": "~4.19.1"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@azure-tools/typespec-autorest": "~0.
|
|
81
|
-
"@azure-tools/typespec-azure-core": "~0.
|
|
82
|
-
"@azure-tools/typespec-azure-resource-manager": "~0.
|
|
83
|
-
"@azure-tools/typespec-azure-rulesets": "~0.
|
|
84
|
-
"@azure-tools/typespec-client-generator-core": "~0.
|
|
85
|
-
"@azure-tools/azure-http-specs": "0.1.0-alpha.
|
|
86
|
-
"@typespec/compiler": "^1.
|
|
87
|
-
"@typespec/http": "^1.
|
|
88
|
-
"@typespec/openapi": "^1.
|
|
89
|
-
"@typespec/rest": "~0.
|
|
90
|
-
"@typespec/versioning": "~0.
|
|
91
|
-
"@typespec/events": "~0.
|
|
92
|
-
"@typespec/spector": "0.1.0-alpha.
|
|
93
|
-
"@typespec/spec-api": "0.1.0-alpha.
|
|
94
|
-
"@typespec/sse": "~0.
|
|
95
|
-
"@typespec/streams": "~0.
|
|
96
|
-
"@typespec/xml": "~0.
|
|
97
|
-
"@typespec/http-specs": "0.1.0-alpha.
|
|
80
|
+
"@azure-tools/typespec-autorest": "~0.59.0",
|
|
81
|
+
"@azure-tools/typespec-azure-core": "~0.59.0",
|
|
82
|
+
"@azure-tools/typespec-azure-resource-manager": "~0.59.0",
|
|
83
|
+
"@azure-tools/typespec-azure-rulesets": "~0.59.0",
|
|
84
|
+
"@azure-tools/typespec-client-generator-core": "~0.59.0",
|
|
85
|
+
"@azure-tools/azure-http-specs": "0.1.0-alpha.25",
|
|
86
|
+
"@typespec/compiler": "^1.3.0",
|
|
87
|
+
"@typespec/http": "^1.3.0",
|
|
88
|
+
"@typespec/openapi": "^1.3.0",
|
|
89
|
+
"@typespec/rest": "~0.73.0",
|
|
90
|
+
"@typespec/versioning": "~0.73.0",
|
|
91
|
+
"@typespec/events": "~0.73.0",
|
|
92
|
+
"@typespec/spector": "0.1.0-alpha.17",
|
|
93
|
+
"@typespec/spec-api": "0.1.0-alpha.8",
|
|
94
|
+
"@typespec/sse": "~0.73.0",
|
|
95
|
+
"@typespec/streams": "~0.73.0",
|
|
96
|
+
"@typespec/xml": "~0.73.0",
|
|
97
|
+
"@typespec/http-specs": "0.1.0-alpha.25",
|
|
98
98
|
"@types/js-yaml": "~4.0.5",
|
|
99
|
-
"@types/node": "~
|
|
99
|
+
"@types/node": "~24.1.0",
|
|
100
100
|
"@types/semver": "7.5.8",
|
|
101
101
|
"c8": "^10.1.3",
|
|
102
102
|
"chalk": "5.3.0",
|
|
103
103
|
"rimraf": "~6.0.1",
|
|
104
104
|
"typescript": "~5.8.2",
|
|
105
105
|
"typescript-eslint": "^8.21.0",
|
|
106
|
-
"vitest": "^3.
|
|
106
|
+
"vitest": "^3.1.2"
|
|
107
107
|
}
|
|
108
108
|
}
|