@autorest/python 6.1.8 → 6.1.9

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.
@@ -75,7 +75,8 @@ class ModelType(
75
75
  @property
76
76
  def serialization_type(self) -> str:
77
77
  if self.code_model.options["models_mode"] == "msrest":
78
- return f"{'' if self.is_public else (self.code_model.models_filename + '.')}{self.name}"
78
+ private_model_path = f"_models.{self.code_model.models_filename}."
79
+ return f"{'' if self.is_public else private_model_path}{self.name}"
79
80
  if self.code_model.options["models_mode"] == "dpg":
80
81
  return f"{'' if self.is_public else '_models.'}_models.{self.name}"
81
82
  return "object"
@@ -1258,9 +1258,12 @@ class _PagingOperationSerializer(
1258
1258
  response = builder.responses[0]
1259
1259
  deserialized = "pipeline_response.http_response.json()"
1260
1260
  if self.code_model.options["models_mode"] == "msrest":
1261
- deserialized = (
1262
- f'self._deserialize("{response.serialization_type}", pipeline_response)'
1263
- )
1261
+ deserialize_type = response.serialization_type
1262
+ pylint_disable = " # pylint: disable=protected-access"
1263
+ if isinstance(response.type, ModelType) and response.type.is_public:
1264
+ deserialize_type = f'"{response.serialization_type}"'
1265
+ pylint_disable = ""
1266
+ deserialized = f"self._deserialize(\n {deserialize_type}, pipeline_response{pylint_disable}\n)"
1264
1267
  elif self.code_model.options["models_mode"] == "dpg":
1265
1268
  deserialized = (
1266
1269
  f"_deserialize({response.serialization_type}, pipeline_response)"
@@ -1440,6 +1443,7 @@ class _LROOperationSerializer(_OperationSerializer[LROOperationType]):
1440
1443
  retval.append(" response_headers = {}")
1441
1444
  if (
1442
1445
  not self.code_model.options["models_mode"]
1446
+ or self.code_model.options["models_mode"] == "dpg"
1443
1447
  or builder.lro_response.headers
1444
1448
  ):
1445
1449
  retval.append(" response = pipeline_response.http_response")
@@ -29,10 +29,11 @@ class {{ code_model.client.name }}OperationsMixin(object):
29
29
  mixin_instance = OperationClass()
30
30
  mixin_instance._client = self._client
31
31
  mixin_instance._config = self._config
32
+ mixin_instance._config.api_version = api_version
32
33
  mixin_instance._serialize = Serializer(self._models_dict(api_version))
33
34
  {% if not code_model.client.client_side_validation %}
34
35
  mixin_instance._serialize.client_side_validation = False
35
36
  {% endif %}
36
37
  mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
37
38
  return {{ "await " if mixin_operation.coroutine(async_mode) }}mixin_instance.{{ mixin_operation.name }}({{ mixin_operation.call(async_mode) }})
38
- {% endfor %}
39
+ {% endfor %}
@@ -135,6 +135,7 @@ class {{ code_model.client.name }}({% if code_model.operation_mixin_group.mixin_
135
135
  {% endfor %}
136
136
  else:
137
137
  raise ValueError("API version {} does not have operation group '{{ operation_group.name }}'".format(api_version))
138
+ self._config.api_version = api_version
138
139
  return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
139
140
  {% endfor %}
140
141
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorest/python",
3
- "version": "6.1.8",
3
+ "version": "6.1.9",
4
4
  "description": "The Python extension for generators in AutoRest.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  "@autorest/system-requirements": "~1.0.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@microsoft.azure/autorest.testserver": "^3.3.38",
24
+ "@microsoft.azure/autorest.testserver": "^3.3.41",
25
25
  "typescript": "^4.8.3"
26
26
  },
27
27
  "files": [