@autorest/python 6.17.0 → 6.17.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/generator/pygen/codegen/models/operation.py +3 -1
- package/generator/pygen/codegen/models/operation_group.py +1 -1
- package/generator/pygen/codegen/serializers/general_serializer.py +6 -5
- package/generator/pygen/codegen/templates/model_dpg.py.jinja2 +3 -2
- package/package.json +2 -2
- package/scripts/__pycache__/venvtools.cpython-310.pyc +0 -0
|
@@ -495,7 +495,9 @@ class Operation(OperationBase[Response]):
|
|
|
495
495
|
relative_path = "..." if async_mode else ".."
|
|
496
496
|
if self.code_model.options["models_mode"] == "dpg":
|
|
497
497
|
if self.parameters.has_body:
|
|
498
|
-
if
|
|
498
|
+
if self.has_form_data_body:
|
|
499
|
+
file_import.add_submodule_import(relative_path, "_model_base", ImportType.LOCAL)
|
|
500
|
+
else:
|
|
499
501
|
file_import.add_submodule_import(
|
|
500
502
|
f"{relative_path}_model_base",
|
|
501
503
|
"SdkJSONEncoder",
|
|
@@ -114,7 +114,7 @@ class OperationGroup(BaseModel):
|
|
|
114
114
|
and not self.is_mixin
|
|
115
115
|
):
|
|
116
116
|
file_import.add_submodule_import(relative_path, "models", ImportType.LOCAL, alias="_models")
|
|
117
|
-
if self.
|
|
117
|
+
if self.is_mixin:
|
|
118
118
|
file_import.add_submodule_import(".._vendor", f"{self.client.name}MixinABC", ImportType.LOCAL)
|
|
119
119
|
if self.has_abstract_operations:
|
|
120
120
|
file_import.add_submodule_import(".._vendor", "raise_if_not_implemented", ImportType.LOCAL)
|
|
@@ -105,11 +105,12 @@ class GeneralSerializer(BaseSerializer):
|
|
|
105
105
|
typing_section=TypingSection.TYPING,
|
|
106
106
|
)
|
|
107
107
|
for client in clients:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
if client.has_mixin:
|
|
109
|
+
file_import.add_submodule_import(
|
|
110
|
+
"._configuration",
|
|
111
|
+
f"{client.name}Configuration",
|
|
112
|
+
ImportType.LOCAL,
|
|
113
|
+
)
|
|
113
114
|
if self.code_model.has_etag:
|
|
114
115
|
file_import.add_submodule_import("typing", "Optional", ImportType.STDLIB)
|
|
115
116
|
file_import.add_submodule_import(
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
__flattened_items = ["{{ model.flattened_items|join('\", \"') }}"]
|
|
46
46
|
{% endif %}
|
|
47
47
|
|
|
48
|
-
{%
|
|
48
|
+
{% set need_init = (not model.internal) and (serializer.init_line(model) or model.discriminator)%}
|
|
49
|
+
{% if need_init %}
|
|
49
50
|
@overload
|
|
50
51
|
def __init__(
|
|
51
52
|
self,
|
|
@@ -64,7 +65,7 @@
|
|
|
64
65
|
|
|
65
66
|
{% endif %}
|
|
66
67
|
{% set initialize_properties = serializer.initialize_properties(model) %}
|
|
67
|
-
{% if
|
|
68
|
+
{% if need_init or initialize_properties %}
|
|
68
69
|
def __init__(self, *args: Any, **kwargs: Any) -> None:{{ '# pylint: disable=useless-super-delegation' if not initialize_properties else '' }}
|
|
69
70
|
{% for line in serializer.super_call(model) %}
|
|
70
71
|
{{ line }}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autorest/python",
|
|
3
|
-
"version": "6.17.
|
|
3
|
+
"version": "6.17.1",
|
|
4
4
|
"description": "The Python extension for generators in AutoRest.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@microsoft.azure/autorest.testserver": "^3.3.46",
|
|
27
27
|
"typescript": "~5.1.3",
|
|
28
|
-
"@azure-tools/typespec-python": "^0.27.
|
|
28
|
+
"@azure-tools/typespec-python": "^0.27.1"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"autorest/**/*.py",
|
|
Binary file
|