Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
| --------------- | -------
|`@autorest/core` | `3.6.2`
|`@autorest/modelerfour` | `4.19.1`
|`azure-core` dep of generated code | `1.18.0`
|`azure-core` dep of generated code | `1.19.0`
|`msrest` dep of generated code | `0.6.21`
|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0`

Expand Down
9 changes: 1 addition & 8 deletions autorest/codegen/models/code_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,7 @@ def need_vendored_code(self) -> bool:

@property
def need_request_converter(self) -> bool:
if not self.options["show_operations"]:
return False
if not self.options["version_tolerant"]:
return True
for og in self.operation_groups:
if any(o for o in og.operations if o.use_pipeline_transport):
return True
return False
return self.options["show_operations"] and not self.options["version_tolerant"]

@property
def need_format_url(self) -> bool:
Expand Down
2 changes: 0 additions & 2 deletions autorest/codegen/models/lro_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def __init__(
)
self.lro_options = yaml_data.get("extensions", {}).get("x-ms-long-running-operation-options", {})
self.name = "begin_" + self.name
self.use_pipeline_transport = True

@property
def lro_response(self) -> Optional[SchemaResponse]:
Expand Down Expand Up @@ -91,7 +90,6 @@ def initial_operation(self) -> Operation:
want_tracing=False,
)
operation.request_builder = self.request_builder
operation.use_pipeline_transport = True
return operation

@property
Expand Down
1 change: 0 additions & 1 deletion autorest/codegen/models/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def __init__(
self.want_tracing = want_tracing
self._request_builder: Optional[RequestBuilder] = None
self.deprecated = False
self.use_pipeline_transport = False

@property
def python_name(self) -> str:
Expand Down
1 change: 0 additions & 1 deletion autorest/codegen/models/paging_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def __init__(
self.operation_name: str = yaml_data["extensions"]["x-ms-pageable"].get("operationName")
self.next_operation: Optional[Operation] = None
self.override_success_response_to_200 = override_success_response_to_200
self.use_pipeline_transport = True

def _get_response(self) -> SchemaResponse:
response = self.responses[0]
Expand Down
19 changes: 6 additions & 13 deletions autorest/codegen/serializers/builder_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ def _call_request_builder_helper(
template_url = template_url or f"self.{builder.name}.metadata['url']"
retval.append(f" template_url={template_url},")
retval.append(f")")
if not self.code_model.options["version_tolerant"] or builder.use_pipeline_transport:
if not self.code_model.options["version_tolerant"]:
pass_files = ""
if "files" in builder.body_kwargs_to_pass_to_request_builder:
pass_files = ", files"
Expand All @@ -795,7 +795,6 @@ def call_request_builder(self, builder: BuilderType) -> List[str]:

def response_headers_and_deserialization(
self,
builder: BuilderType,
response: SchemaResponse,
) -> List[str]:
retval: List[str] = [
Expand All @@ -820,14 +819,8 @@ def response_headers_and_deserialization(
else:
is_xml = any(["xml" in ct for ct in response.media_types])
deserialized_value = ""
if is_xml:
deserialized_value = "ET.fromstring(response.text())"
elif builder.use_pipeline_transport:
deserialized_value = "_loads(response.body())"
else:
deserialized_value = "response.json()"
response_body = "response.body()" if builder.use_pipeline_transport else "response.content"
retval.append(f"if {response_body}:")
deserialized_value = "ET.fromstring(response.text())" if is_xml else "response.json()"
retval.append(f"if response.content:")
retval.append(f" deserialized = {deserialized_value}")
retval.append("else:")
retval.append(" deserialized = None")
Expand Down Expand Up @@ -870,12 +863,12 @@ def handle_response(self, builder: BuilderType) -> List[str]:
retval.append(f"if response.status_code == {status_code}:")
retval.extend([
f" {line}"
for line in self.response_headers_and_deserialization(builder, response)
for line in self.response_headers_and_deserialization(response)
])
retval.append("")
else:
retval.extend(self.response_headers_and_deserialization(
builder, builder.responses[0]
builder.responses[0]
))
retval.append("")
retval.append("if cls:")
Expand Down Expand Up @@ -1258,7 +1251,7 @@ def get_long_running_output(self, builder: BuilderType) -> List[str]:
retval.append(" response = pipeline_response.http_response")
retval.extend([
f" {line}"
for line in self.response_headers_and_deserialization(builder, builder.lro_response)
for line in self.response_headers_and_deserialization(builder.lro_response)
])
retval.append(" if cls:")
retval.append(" return cls(pipeline_response, {}, {})".format(
Expand Down
2 changes: 1 addition & 1 deletion autorest/codegen/templates/operation.py.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
{{ op_tools.serialize(operation_serializer.pop_kwargs_from_signature(operation)) | indent }}
{% endif %}
{{ op_tools.serialize(operation_serializer.call_request_builder(operation)) | indent }}
pipeline_response = {{ keywords.await }}self._client.send_request(request, {{ stream_request_parameter }}, _return_pipeline_response=True, **kwargs)
pipeline_response = {{ keywords.await }}self._client._pipeline.run(request, {{ stream_request_parameter }}, **kwargs)
{{ op_tools.serialize(operation_serializer.handle_response(operation)) | indent }}
{{ operation.python_name }}.metadata = {'url': {{ keywords.escape_str(request_builder.url) }}} # type: ignore
2 changes: 1 addition & 1 deletion autorest/codegen/templates/setup.py.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ VERSION = "{{ code_model.options.get('package_version', '0.0.0') }}"
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools

REQUIRES = ["msrest>=0.6.21", "azure-core<2.0.0,>=1.18.0"{{ azure_mgmt_core_import }}]
REQUIRES = ["msrest>=0.6.21", "azure-core<2.0.0,>=1.19.0"{{ azure_mgmt_core_import }}]

setup(
name=NAME,
Expand Down
2 changes: 1 addition & 1 deletion docs/client/initializing.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The following are core libraries your generated code depend on, and the minimum

| Library | Description | Min Version |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- |
| [`azure-core`][azure_core_library] | The most important library to have installed. It provides shared exceptions and modules for all the Python SDK client libraries. | 1.18.0 |
| [`azure-core`][azure_core_library] | The most important library to have installed. It provides shared exceptions and modules for all the Python SDK client libraries. | 1.19.0 |
| [`msrest`][msrest_library] | Library mainly used for serializing and deserializing objects | 0.6.21 |
| [`azure-mgmt-core`][azure_mgmt_core_library] | Required if you're generating mgmt plane code (see `--azure-arm` flag in our [flag index][flag_index]. Provides mgmt plane specific shared exceptions and modules. | 1.2.1 |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async def head200(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200, 404]:
Expand Down Expand Up @@ -102,7 +102,7 @@ async def head204(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [204, 404]:
Expand Down Expand Up @@ -140,7 +140,7 @@ async def head404(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [204, 404]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def head200(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200, 404]:
Expand Down Expand Up @@ -153,7 +153,7 @@ def head204(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [204, 404]:
Expand Down Expand Up @@ -192,7 +192,7 @@ def head404(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [204, 404]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools

REQUIRES = ["msrest>=0.6.21", "azure-core<2.0.0,>=1.18.0"]
REQUIRES = ["msrest>=0.6.21", "azure-core<2.0.0,>=1.19.0"]

setup(
name=NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async def head200(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200, 404]:
Expand Down Expand Up @@ -102,7 +102,7 @@ async def head204(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [204, 404]:
Expand Down Expand Up @@ -140,7 +140,7 @@ async def head404(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [204, 404]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def head200(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200, 404]:
Expand Down Expand Up @@ -153,7 +153,7 @@ def head204(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [204, 404]:
Expand Down Expand Up @@ -192,7 +192,7 @@ def head404(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [204, 404]:
Expand Down
2 changes: 1 addition & 1 deletion docs/samples/specification/basic/generated/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools

REQUIRES = ["msrest>=0.6.21", "azure-core<2.0.0,>=1.18.0"]
REQUIRES = ["msrest>=0.6.21", "azure-core<2.0.0,>=1.19.0"]

setup(
name=NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def _basic_polling_initial(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200, 204]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _basic_polling_initial(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200, 204]:
Expand Down
2 changes: 1 addition & 1 deletion docs/samples/specification/directives/generated/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools

REQUIRES = ["msrest>=0.6.21", "azure-core<2.0.0,>=1.18.0"]
REQUIRES = ["msrest>=0.6.21", "azure-core<2.0.0,>=1.19.0"]

setup(
name=NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async def head200(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200, 404]:
Expand Down Expand Up @@ -104,7 +104,7 @@ async def head204(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [204, 404]:
Expand Down Expand Up @@ -143,7 +143,7 @@ async def head404(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [204, 404]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def head200(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200, 404]:
Expand Down Expand Up @@ -155,7 +155,7 @@ def head204(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [204, 404]:
Expand Down Expand Up @@ -195,7 +195,7 @@ def head404(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [204, 404]:
Expand Down
2 changes: 1 addition & 1 deletion docs/samples/specification/management/generated/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools

REQUIRES = ["msrest>=0.6.21", "azure-core<2.0.0,>=1.18.0", "azure-mgmt-core<2.0.0,>=1.2.1"]
REQUIRES = ["msrest>=0.6.21", "azure-core<2.0.0,>=1.19.0", "azure-mgmt-core<2.0.0,>=1.2.1"]

setup(
name=NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async def test_one(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
Expand Down Expand Up @@ -102,7 +102,7 @@ async def _test_lro_initial(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200, 204]:
Expand Down Expand Up @@ -211,7 +211,7 @@ async def _test_lro_and_paging_initial(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
Expand Down Expand Up @@ -388,7 +388,7 @@ async def test_different_calls(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
Expand Down
Loading