@autorest/python 6.9.5 → 6.9.6

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.
@@ -192,7 +192,7 @@ class ClientSerializer:
192
192
 
193
193
  def _send_request_signature(self) -> str:
194
194
  send_request_signature = [
195
- "request: HttpRequest,"
195
+ "request: HttpRequest, *, stream: bool = False,"
196
196
  ] + self.client.parameters.method_signature_kwargs
197
197
  return self.parameter_serializer.serialize_method(
198
198
  function_def="def",
@@ -24,7 +24,7 @@
24
24
  {% else %}
25
25
  request_copy.url = self._client.format_url(request_copy.url)
26
26
  {% endif %}
27
- return self._client.send_request(request_copy, **kwargs) # type: ignore
27
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
28
28
 
29
29
  {{ keywords.def }} close(self) -> None:
30
30
  {{ keywords.await }}self._client.close()
@@ -77,7 +77,7 @@ setup(
77
77
  ),
78
78
  include_package_data=True,
79
79
  package_data={
80
- 'pytyped': ['py.typed'],
80
+ '{{ code_model.namespace }}': ['py.typed'],
81
81
  },
82
82
  {% else %}
83
83
  packages=find_packages(),
@@ -20,30 +20,6 @@ from .. import YamlUpdatePlugin, YamlUpdatePluginAutorest
20
20
  from .._utils import parse_args, get_body_type_for_description, JSON_REGEXP, KNOWN_TYPES
21
21
 
22
22
 
23
- def add_body_param_type(
24
- code_model: Dict[str, Any],
25
- body_parameter: Dict[str, Any],
26
- ):
27
- if (
28
- body_parameter
29
- and body_parameter["type"]["type"] in ("model", "dict", "list")
30
- and any(
31
- ct for ct in body_parameter.get("contentTypes", []) if JSON_REGEXP.match(ct)
32
- )
33
- and not body_parameter["type"].get("xmlMetadata")
34
- and not any(t for t in ["flattened", "groupedBy"] if body_parameter.get(t))
35
- ):
36
- origin_type = body_parameter["type"]["type"]
37
- is_dpg_model = body_parameter["type"].get("base") == "dpg"
38
- body_parameter["type"] = {
39
- "type": "combined",
40
- "types": [body_parameter["type"], KNOWN_TYPES["binary"]],
41
- }
42
- if origin_type == "model" and is_dpg_model:
43
- body_parameter["type"]["types"].insert(1, KNOWN_TYPES["any-object"])
44
- code_model["types"].append(body_parameter["type"])
45
-
46
-
47
23
  def update_overload_section(
48
24
  overload: Dict[str, Any],
49
25
  yaml_data: Dict[str, Any],
@@ -216,6 +192,32 @@ class PreProcessPlugin(YamlUpdatePlugin): # pylint: disable=abstract-method
216
192
  def is_cadl(self) -> bool:
217
193
  return self.options.get("cadl_file", False)
218
194
 
195
+ def add_body_param_type(
196
+ self,
197
+ code_model: Dict[str, Any],
198
+ body_parameter: Dict[str, Any],
199
+ ):
200
+ if (
201
+ body_parameter
202
+ and body_parameter["type"]["type"] in ("model", "dict", "list")
203
+ and any(
204
+ ct
205
+ for ct in body_parameter.get("contentTypes", [])
206
+ if JSON_REGEXP.match(ct)
207
+ )
208
+ and not body_parameter["type"].get("xmlMetadata")
209
+ and not any(t for t in ["flattened", "groupedBy"] if body_parameter.get(t))
210
+ ):
211
+ origin_type = body_parameter["type"]["type"]
212
+ is_dpg_model = body_parameter["type"].get("base") == "dpg"
213
+ body_parameter["type"] = {
214
+ "type": "combined",
215
+ "types": [body_parameter["type"], KNOWN_TYPES["binary"]],
216
+ }
217
+ if origin_type == "model" and is_dpg_model and self.models_mode == "dpg":
218
+ body_parameter["type"]["types"].insert(1, KNOWN_TYPES["any-object"])
219
+ code_model["types"].append(body_parameter["type"])
220
+
219
221
  def pad_reserved_words(self, name: str, pad_type: PadType):
220
222
  # we want to pad hidden variables as well
221
223
  if not name:
@@ -413,7 +415,7 @@ class PreProcessPlugin(YamlUpdatePlugin): # pylint: disable=abstract-method
413
415
  response["discriminator"] = "operation"
414
416
  if body_parameter and not is_overload:
415
417
  # if we have a JSON body, we add a binary overload
416
- add_body_param_type(code_model, body_parameter)
418
+ self.add_body_param_type(code_model, body_parameter)
417
419
  add_overloads_for_body_param(yaml_data)
418
420
 
419
421
  def _update_lro_operation_helper(self, yaml_data: Dict[str, Any]) -> None:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorest/python",
3
- "version": "6.9.5",
3
+ "version": "6.9.6",
4
4
  "description": "The Python extension for generators in AutoRest.",
5
5
  "main": "index.js",
6
6
  "repository": {